I am using the ASP.NET MVC SiteMap provider in a project, and it is working great. I am having a tough time trying to figure out how to hide a menu item however. The menu item I want to hide from displaying in the global navigation is my "Site Map" page. Now I know that there is something called a VisibilityProvider
available to me on the mvcSiteMapNode - but I can't seem to figure out how to make it work.
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- Avoid overlapping of nodes in tree layout in d3.js
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
相关文章
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
- entity type has no key defined - Code first
Taken from my answer here explaining how to hide nodes and options available.
https://stackoverflow.com/a/27095721/853295
You should use this guide on how to hide a node
https://github.com/maartenba/MvcSiteMapProvider/wiki/Advanced-Node-Visibility-with-ISiteMapNodeVisibilityProvider
Some settings you can set from the link above:
Once you have added the app settings, add the following to any node you want to see in the breadcrumbs but not the menu:
visibility="SiteMapPathHelper,!*"
(SiteMapPathHelper - the node is visible in the sitemappath, !* - it is invisible for all other controls)eg:
Other options available:
Type..........................What it Affects
CanonicalHelper.......The Canonical HTML Helper
MenuHelper..............The Menu HTML Helper
MetaRobotsHelper....The Meta Robots HTML Helper
SiteMapHelper..........The SiteMap HTML Helper
SiteMapPathHelper...The SiteMapPath HTML Helper
SiteMapTitleHelper...The Title HTML Helper
XmlSiteMapResult....The sitemaps XML output of the /sitemap.xml endpoint
First, I suggest you read this wiki page: Creating a Custom SiteMapNodeVisibilityProvider. Then for the specific node that points to your Site Map page, declare it this way:
Now, when implementing the
IsVisible
method (shown in the wiki page linked above), you can do this: