Search code examples
c#asp.netrenderingaspmenu

Tweaking ASP.NET Menu control like a mega dropdown


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?


Solution

  • 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