How to see submenus

Sep 30, 2009 at 7:31 AM

I can see submenus if i use this code

<asp:Menu ID="MenuAspNet" runat="server" DataSourceID="SiteMapDataSource1" >
                <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
                    ShowStartingNode="False" />

i can not see submenus if i use this code

<%=Html.Menu("selected", new { id = "menu" })%>

is it not possible to see submenus using Menu helper?

Sep 30, 2009 at 8:30 AM

That is correct, the menu helper does not provide submenu functionality. The first approach you mentioned is corerct.

Sep 30, 2009 at 10:05 AM

first approach can not use visibility="InSiteMapPathOnly" property.

will you add submenu feature to the helper?


Sep 30, 2009 at 4:24 PM

Actually, if you get the latest code from the repository, I added this feature.   Also supported is a maxLevels parameter.

Oct 1, 2009 at 8:05 AM

i got the latest code. how can i use this new feature? will it show me submenus as drop down menu like asp:menu does?

Oct 1, 2009 at 12:04 PM

The latest code builds nested unordered lists.  This is how all css based menus are built now.

So, you just use a jQuery plug-in like this:


Oct 2, 2009 at 6:05 PM
Edited Oct 2, 2009 at 6:17 PM

I'm using version 31848 and there is no submenue

is there a parameter to set ?


sorry it works simply needs to set a maxLevel higher than 1

Oct 24, 2009 at 10:31 PM

Hi, I am also having trouble with seeing submenus. 
I couldn't find where to set the maxLevels parameter (?). 

I tried to set the startingNodeLevel, but any value passed to it, causes the menu not to render anything at all except for an empty ul with class (<ul class="test"></ul>)

Here is the code used: <%=Html.Menu(1, "test", "current", new { id = "navigation_main" }) %>

Do you have any idea of what I might be doing wrong? 

Thanks in advance and best regards!