Wednesday, August 11, 2010

How to occupy multiple site map files in a single website in asp.net

There are some occations where we need to provide two menu structures. For example top navigation and left navigation. In such cases we can easily configure two XML Sitemap providers in web.config and use them separately in the asp.net pages
Web.config
<siteMap>
  <providers>
    <add siteMapFile="topNavigation.sitemap" name="TopNavigationSiteMapProvider"
        type="System.Web.XmlSiteMapProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add siteMapFile="leftNavigation.sitemap" name="leftNavigationSiteMapProvider"
        type="System.Web.XmlSiteMapProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
</siteMap>

Markup
<asp:SiteMapDataSource ID="smdTopNavigation" SiteMapProvider="TopNavigationSiteMapProvider" runat="server" />
<asp:Menu runat="server" ID="mnuTopNavigation" DataSourceID="smdTopNavigation" />
 
<asp:SiteMapDataSource ID="smdLeftNavigation" SiteMapProvider="LeftNavigationSiteMapProvider" runat="server" />
<asp:Menu runat="server" ID="menuLeftNavigation" DataSourceID="smdLeftNavigation" />

No comments:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...