Reputation: 1003
My site should print the following menu:
The root menu should not be any link, it's just a container to hold the actual submenus. Can this be accomplish with mvcSiteMap?
I tried the following, but the "List" is never the CurrentNode. "Customers" always get the IsCurrentNode and I can't apply the write css because of that:
<mvcSiteMapNode title="Home" controller="Home" action="Index" visibility="MenuHelper,!*">
<mvcSiteMapNode title="Customers" controller="Customer" action="Index" area="Admin" clickable="false" description="Todos os clientes cadastrados" cssClass="icon-group">
<mvcSiteMapNode title="List" action="Index" description="Todos os clientes cadastrados"/>
<mvcSiteMapNode title="the customers" action="Details" preservedRouteParameters="customerId" visibility="SiteMapPathHelper,!*"/>
<mvcSiteMapNode title="New" action="New" />
</mvcSiteMapNode>
</mvcSiteMapNode>
Upvotes: 3
Views: 1242
Reputation: 56849
You just need to remove "Index" from the non-clickable grouping node so it is never matched. Basically, you have 2 nodes with the exact same route signature here:
area="Admin" controller="Customer" action="Index"
The first one that matches in the SiteMap always wins. So if you remove "Index" from the first one (you can because it is non-clickable, so all of the route settings are ignored on that node but can still be inherited), it will never be matched as long as you have a default action configured in your routes.
<mvcSiteMapNode title="Home" controller="Home" action="Index" visibility="MenuHelper,!*">
<mvcSiteMapNode title="Customers" controller="Customer" area="Admin" clickable="false" description="Todos os clientes cadastrados" cssClass="icon-group">
<mvcSiteMapNode title="List" action="Index" description="Todos os clientes cadastrados"/>
<mvcSiteMapNode title="the customers" action="Details" preservedRouteParameters="customerId" visibility="SiteMapPathHelper,!*"/>
<mvcSiteMapNode title="New" action="New" />
</mvcSiteMapNode>
</mvcSiteMapNode>
Upvotes: 3