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.



Will you give this article a +1 ? Thanks in advance


About The Author

Suprotim Agarwal
Suprotim Agarwal, Developer Technologies MVP (Microsoft Most Valuable Professional) is the founder and contributor for DevCurry, DotNetCurry and SQLServerCurry. He is the Chief Editor of a Developer Magazine called DNC Magazine. He has also authored two Books - 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook.

Follow him on twitter @suprotimagarwal.

No comments: