Question

I am looking to create a multi level drop down menu in asp.net using c# for a composite control. Does anyone know, or know any pointers on how to create it?

I've looked at system.ui.webcontrols.menu, but I don't think this offers the functionality I require. Ideally it should be as simple as possible. It doesn't have to use hover effects of css as it will use an onclick to make the drop down fire.

Any pointers would be appreciated.

I am open to jQuery options aslong as they are quite simple, and easily modifiable.

Thanks again.

Was it helpful?

Solution

If you want an easy menu without on hover effects i would suggest the use of the Menu control. :P However, otherwise the easiest way would be using CSS and html. A normal list or something.


Example ASP menu with/without submenu.

<asp:Menu ID="Menu1" runat="server" >
<Items>

/*Single depth without subs*/
<asp:MenuItem value="aa" Selectable="true" NavigateUrl="~/Pages/aa.aspx" text="aa">

/*Single depth with subs*/
<asp:MenuItem NavigateUrl="~/Pages/xx.aspx" Text="xx" Value="xx" Selectable="true">
<asp:MenuItem NavigateUrl="~/Pages/yy.aspx" Text="yy" Value="yy" Selectable="true"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Pages/zz.aspx" Text="zz" Value="zz" Selectable="true"></asp:MenuItem>
</asp:MenuItem>                    
</Items>
</asp:Menu>

OTHER TIPS

basically, if youre going to use jquery for this there are 2 approaches you can take. You can either assign the style rules on the fly to change the display settings(likely between display:none and display:block) using the jquery .css() method

or

you can make up some css classes and then add and remove them on the fly with the .addClass() and .removeClass methods. its basically a bit simpler than changing the style attributes one by one this way because you can do it all at once

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top