Reputation: 15446
I have a field in database that can be true or false. I want to show web1.sitemap if that field is true andshow web2.sitemap if that is false. How to I do this.
Upvotes: 1
Views: 1482
Reputation: 18290
You can add two sitemap datasouurce and then assign those datasource to your control in code as you do with data controls. i have implemented in this way and working fine for me.
for example. menu1.datasource = sitemapdatasouce1;
you can create your own site map providers etc in code.. it is not much complicated.. look at msdn.. http://msdn.microsoft.com/en-us/library/ms178432.aspx
http://msdn.microsoft.com/en-us/library/ms178433.aspx
i like to create my sitmap provider class and create sitemap provider object and assign it to sitemapdatasource class object.. then you can use this sitemap datasource object as typed sitemapDatasource.. hope this help you a little..
Upvotes: 1
Reputation: 7797
You could setup multiple sitemaps in your web.config. And depending on the value of your database field, change the SiteMapProvider of your Menu/Treeview to the relevant one: web1 or web2 for example.
<configuration>
<!-- other configuration sections -->
<system.web>
<!-- other configuration sections -->
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add
name="web1"
type="System.Web.XmlSiteMapProvider"
siteMapFile="~/web1.sitemap" />
<add
name="web2"
type="System.Web.XmlSiteMapProvider"
siteMapFile="~/web2.sitemap" />
</providers>
</siteMap>
</system.web>
</configuration>
Upvotes: 1