Monday, July 27, 2009

Localizing SiteMap in

In 2.0 we have a good feature which is Localizing SiteMap .
the are ways to add the localization to you'r site map when you are using xmlSiteMapProvider

you can do that via Explicitly and Implicitly also .
  • using Explicitly

  • <asp:textBox id="Exp" Value='<%$ Resources: Common, Textgoeshere%>'...> </asp:TextBox>

  • using Implictly

  • <asp:Label ID="Impl" meta:ResourceKey="sometext" ... />

    You can also use Programmatically by calling to page.GetLocalResourceObject(...) or Page.GetGlobalResourceObject.

    and this will control all . The menu and Sitemap can be linked to the SiteMapDataSource. we can also localized sitemapitself like that you can do this

    At first Set the attribute enableLocalization="true" . Now add thje resourceKey Attribute to all the SiteMapNode element that you want to Localize.

    Implicit version of Localization

    <siteMap xmlns="" enableLocalization="true">

    <siteMapNode title="Root" description="Description on Link">

    <siteMapNode url="~/Default.aspx" title="Index" resourceKey="Index" description="Main Page" />

    <siteMapNode url="~/Update.aspx" title="Update Resource" resourceKey="Update" description="Update Record" />




    You can also add the Explicit Version by adding all the resources like title,Description to the resx file by using ResourceKey Property
    like Index.title and Index.Description.

    now as per the Example of ResourceKey file .

    in this file you can get file name could be a resourceKey + "." + Property of siteMap node. you can update that part with the following explicit expressions way

    <siteMapNode url="~/Update.aspx" title="$Resources: SiteMapResourceFile, UpdatePosting" ...="" />

    in this case Your resource file should be located in App_GlobalResources and that must be call ClassName.culture.resx

    No comments:

    Post a Comment