views:

1148

answers:

1

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?

+3  A: 

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"
Greg