March 22, 2011

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.



Giving me +1 tells me you liked this article! Thanks in advance


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

0 Responses to "Bind to Multiple ASP.NET Site Map files"
 

Copyright © 2009-2013 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions