I think I'm missing something obvious about sitemaps.
I'm trying to use a repeater to generate some navigation for a new sitemap we have on our site. But I don't want to use our normal Web.sitemap file, I want to use our new one...we'll call it "Web.NEW.sitemap".
The code seems somewhat obvious to a point...
<asp:Repeater ID="rptMyRepeater" DataSourceID="mySitemap" runat="server">
<ItemTemplate>
blah blah blah
</ItemTemplate>
</asp:Repeater>
<asp:SiteMapDataSource ID="mySitemap" runat="server" />
But how do I get SiteMapDataSource to use Web.NEW.sitemap instead of the default sitemap? I thought adding an attribute like:
SiteMapProvider="Web.NEW.sitemap"
ought to do it, but no dice.
What am I missing?
You have to configure your web.config properly to make use of the SiteMapDataSource property. Use the SiteMap element:
<siteMap defaultProvider="oldProvider">
<providers>
<clear />
<add name="oldProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="web.sitemap" />
<add name="newProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.NEW.sitemap" />
</providers>
</siteMap>
and then set the SiteMapProvider property to the provider's name from the web.config file.
SiteMapProvider="newProvider"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With