I'm using a bootstrap template that has sitemap. How to hide a node in Sitemap from a controller. Here is example of My MvcSiteMap. I want to hide SamplePage Node by a condition in controller.
<mvcSiteMapNode title="Home" clickable="false" icon="fa fa-home" visibility="SiteMapPathHelper,!"></mvcSiteMapNode>
<mvcSiteMapNode title="Dashboard" controller="Dashboard" action="Index" icon="fa fa-dashboard"></mvcSiteMapNode>
<mvcSiteMapNode title="Sample Page" controller="Sample" action="Index" icon="fa fa-info">
<mvcSiteMapNode title="Master" clickable="false" icon="fa fa-info"></mvcSiteMapNode>
</mvcSiteMapNode>
If you want to hide it by condition in your controller, you could achieve it only on this way, you should probably create a property in object that you'r returning from a controller, and that propertly might be called for example :
And what you might do on your View is next (I hope you know that Razor code blocks are enclosed in @{ ... })
In code above I said if set state of property HideSamplePage to true, then
<mvcSiteMapNode title="Sample Page" controller="Sample" action="Index" icon="fa fa-info">wont be shown/generated.else show
SamplePagealso