JMK
JMK

Reputation: 28079

How do I link a Navigation Menu to an already existing Sitemap

I am just beginning my journey into web development and I have a very basic question, but I am none the less stumped.

I have setup a new ASP.NET Empty Web Application. In this application, I have created a few *.aspx pages and a sitemap called 'Web.sitemap'.

I have placed a SiteMapPath control onto my Master page and, with no further configuration, this detected my Web.sitemap and displays the location of the page on any *.aspx page which derives from the master page.

However, whenever I add a Navigation Menu, this doesn't happen. When I bring up the Menu Tasks dialogue box, I can't select this from the Choose Data Source dropdown, my only option is to choose <New data source...> which brings up the Data Source Configuration Wizard, and from this I can create a new Site Map, however I want to use the already existing one.

How do I go about this?

Thanks

Upvotes: 0

Views: 327

Answers (1)

Kevin Main
Kevin Main

Reputation: 2344

You need to add a SiteMapDataSource and set its SiteMapProvider property to whatever the name of your default provider is in the Web.Config so it would end up like this

<asp:SiteMapDataSource 
    ID="siteMapDataSource" 
    SiteMapProvider="ProviderName" 
    runat="server" />

Then in your Menu control you need to set the DataSourceID to the ID of the SiteMapDataSource you just added

<asp:Menu
    ID="uxMenuEcProductCategories" 
    runat="server" 
    DataSourceID="siteMapDataSource">
</asp:Menu>

Upvotes: 1

Related Questions