4

Platform:
Website development on ASP.NET 4.0(Webforms) with C#.

Situation:
My rendered ASP.NET Menu control is horizontal and has three levels of data. And I have set StaticDisplayLevels="1" so that the menu shows Level1 data horizontally and onmouseover of level1, the menu displays the level2 data and onmouseover of level2, the menu displays level3 data.

Requirement:
To display level2 and level3 data in a single list, with the children of first level2(if any) get displayed below the first level2 data. Then comes second level2 and its children(if any) and so on.

Want a display like the first one. ASP.NET Menu control displays something like secondConsider the above image. What i would like to have, is a display like the one on the left. But the ASP.NET Menu control renders it like the image on the right side.

I have searched high and low in the net for a solution. I even tried replacing the markup of the generated asp.net control using Menu's DataBound event and then injecting javascript hack to it. I succeeded in it but it lacks reusability.

What I would like to have is a way to implement a re-usable ASP.NET Menu Control with static level2 (and level3) after dynamic level1 which acts like a megadropdown. I am sure that there should be a way and that I am going the wrong way. Any ideas?

naveen
  • 53,448
  • 46
  • 161
  • 251

2 Answers2

0

You must have set the menudisplaylevel in menu control to 3. Please check this

MaximumDynamicDisplayLevels="3"

<asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="1" 
MaximumDynamicDisplayLevels="3" DataSourceID="SiteMapDataSource1" 
Orientation="Horizontal" OnDataBound="Menu1_DataBound">
</asp:Menu>
Bhavik Goyal
  • 2,786
  • 6
  • 23
  • 42
  • what i want is a menu like level1 dynamic, level2 static and so on. it seems that if a dynamic level is reached its child level cannot be static. – naveen Feb 28 '11 at 03:34
  • that is not supported by ASP.NET menu control, for that you have to build your own custom control. and then apply the different CSS as you want. – Bhavik Goyal Feb 28 '11 at 03:50
  • i know bhavik. thats why i came for help. If you had checked the link in my post, you will know how deep i have gone into the issue. i dont post questions in SO without researching. – naveen Feb 28 '11 at 03:56
0

Couldn't get any simple solutions.

Workaround was this made the hierarchal sitemap into a table with parent id for parent xml and 0 if no parent. Then I programmatically created a asp:Menu at code behind from that data

naveen
  • 53,448
  • 46
  • 161
  • 251