Bind to Multiple ASP.NET Site Map files

You can use more than one sitemap file and decide which one to bind to a control. Follow these steps to bind a control like the Menu Control, to multiple ASP.NET Site Map files. Here I am assuming that you have two SiteMap files – Web.sitemap and Web2.sitemap

1. Define an entry in the web.config as following to make use of the siteMap element:

Multiple Sitemap

2. Now assuming your Menu control is bound to the SiteMapDataSource in the following way:

Sitemapdatasource

3. Now just set the SiteMapProvider property of the SiteMapDataSource to the provider's name from the web.config file, as shown below:

SiteMap1.SiteMapProvider = "providertwo";

That’s it! Your menu control will be bound to the providertwo now.

No comments:

Post a Comment