Sreginogemoh
Sreginogemoh

Reputation: 1309

How to display root subnodes in MvcSiteMapProvider

Is there any ways I can display root subnodes in MvcSiteMapProvider So i can have my menu looking like that:

|Home| |About| |Etc|

|Item1|

|Item2|

I want Item1 and Item2 would appeared like index(home) subelements.

Here is my sitemap:

<mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="Item1" controller="Item1" action="Index"/> /**should desplayed like submenu element of Home
    <mvcSiteMapNode title="Item2" controller="Item2" action="Index"/> /**should desplayed like submenu element of Home

    <mvcSiteMapNode title="About" controller="About" action="Index"/>
    <mvcSiteMapNode title="Etc" controller="Etc" action="Index"/>
<mvcSiteMapNode />

But in my case i have

|Home| |Item1| |Item2| |About| |Etc| instead.

Upvotes: 1

Views: 1693

Answers (1)

angularconsulting.au
angularconsulting.au

Reputation: 28279

Take look at this one: https://github.com/maartenba/MvcSiteMapProvider/issues/160 see how sitemap declared there. In your case you go like that:

<mvcSiteMapNode title="Root" clickable="false" changeFrequency="Always">

    <mvcSiteMapNode title="Home" controller="Home" action="Index">
        <mvcSiteMapNode title="Item1" controller="Item1" action="Index"/>
        <mvcSiteMapNode title="Item2" controller="Item2" action="Index"/>
    <mvcSiteMapNode/>

    <mvcSiteMapNode title="About" controller="About" action="Index"/>
    <mvcSiteMapNode title="Etc" controller="Etc" action="Index"/>
<mvcSiteMapNode />

also you need to build your menu like that:

 @Html.MvcSiteMap().Menu(false)

Because by default "show starting node" is set to true.

Upvotes: 2

Related Questions