Chris Liechty
Chris Liechty

Reputation: 60

MvcSiteMapProvider Sub menu within page

I have a web site using MvcSiteMapProvider for the main navigation. I have run into a scenario that I'm unable to figure out.

My site has the following navigation:

navigation screenshot

The site map looks like:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="true">
<mvcSiteMapNode title="Look Up" controller="Lookup" action="Index">
    <mvcSiteMapNode title="PackingList" controller="PackingList" action="Index"> 
        <mvcSiteMapNode title="Configuration" controller="Configuration" action="Printers">
            <mvcSiteMapNode title="Printers" controller="Configuration" action="Printers" />
            <mvcSiteMapNode title="Quick List" controller="Configuration" action="QuickList" />
        </mvcSiteMapNode>
    </mvcSiteMapNode>
</mvcSiteMap>

I have not been able to figure out how to properly leverage the site map for the side tab navigation reliably. I also need to have the Configuration tab remain selected as well as the active side tab.

Upvotes: 1

Views: 902

Answers (1)

Xharze
Xharze

Reputation: 2733

When two nodes have the same controller and action name, the SiteMapProvider cannot determine which node is active, and it always chooses the first matching node, in this case 'Configuration'.

The only way to make both nodes selected is:

  1. Use a different action of the printers menu
  2. Changed the display template to indicate the nodes in the current path with a CSS class or a like

Upvotes: 2

Related Questions