Menu and Submenu Helpers Get ChildNodes of Current node only

Sep 17, 2010 at 4:11 PM
Edited Sep 17, 2010 at 7:48 PM

Apparently, I am suffering from a case of the Mondays.  I was using Menu("selected").  unless you specify the max number of levels, it assumes 1 :(  /facepalm.  What a waste of a day.

Strike this issue, as it is not one.

 


<< ORIGINAL POST >>

 

I have the following site map:

 

 

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-2.0" enableLocalization="true">
<mvcSiteMapNode title="Home" controller="Home" action="Index changeFrequency="Always" updatePriority="Normal" >

<mvcSiteMapNode title="Level1_Page1" controller="level1" action="page1" changeFrequency="Always" updatePriority="Normal">
<mvcSiteMapNode title="Level2_Page1_Sub1" controller="level2" action="page1" changeFrequency="Always" updatePriority="Normal" />
</mvcSiteMapNode>

<mvcSiteMapNode title="Level1_Page2" controller="level1" action="page2" changeFrequency="Always" updatePriority="Normal">
<mvcSiteMapNode title="Level2_Page2_Sub1" controller="level2" action="page2sub1" changeFrequency="Always" updatePriority="Normal" />
</mvcSiteMapNode>

<mvcSiteMapNode title="Level1_Page3" controller="Level1" action="page3" changeFrequency="Always" updatePriority="Normal" />
</mvcSiteMapNode>
</mvcSiteMap>

 

When I use:

<%= Html.MvcSiteMap().Menu() %>

I would expect to get this:

 

 

<ul>
<li>Level1_Page1</li>
<li>
<ul>
<li>Level2_Page1_Sub1</li>
</ul>
</li>
<li>Level1_Page2</li>
<li>
<ul>
<li>Level2_Page2_Sub1</li>
</ul>
</li>
</ul>

 

However, I get this:

 

<ul>
<li>Level1_Page1</li>
<li>Level1_Page2</li>
</ul>

Calling this:

 

<%= Html.MvcSiteMap().Menu("selected") %>
<%= HtmlMvcSiteMap().Submenu(2, "selected") %>

Results in

 

 

<ul>
<li>Level1_Page1</li>
<li>
<ul>
<li>Level2_Page1_Sub1</li>
</ul>
</li>
<li>Level1_Page2</li>
</ul>

 

It appears to me that the Menu and Submenu only look for the ChildNodes of the current node.

Does anyone have an example of a working multi-level menu created using this provider? 

 

Thanks