DropDownList menu with asp: MenuItem

I am trying to create a DropDownList menu using this code:

 <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="ד×Ŗ הבי×Ē"/> <asp:MenuItem NavigateUrl="~/About.aspx" Text="×ĸלינו"/> </Items> </asp:Menu> 

Does anyone know how to make items in a submenu of "ד×Ŗהבי×Ē"?

The answer I found is:

 <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="ד×Ŗ בי×Ē"> <asp:MenuItem NavigateUrl="#" Text="סך הבי×Ē 2"></asp:MenuItem> <asp:MenuItem NavigateUrl ="#" Text = "סך הבי×Ē 3"></asp:MenuItem> </asp:MenuItem> <asp:MenuItem NavigateUrl="~/About.aspx" Text="הר×ĸיון הכללי"/> <asp:MenuItem NavigateUrl="~/programs.aspx" Text="ה×Ēוכנו×Ē וה×Ēוספים של הא×Ēר" /> <asp:MenuItem NavigateUrl="~/crew.aspx" Text="×Ļוו×Ē?" /> </Items> 
+4
source share
2 answers

You can just make MenuItem not self-closing, but embed a submenu (drop-down) elements inside it. Like this:

 <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="ד×Ŗ הבי×Ē"> <asp:MenuItem NavigateUrl="~/Page1.aspx" Text="Page1"> <asp:MenuItem NavigateUrl="~/Page2.aspx" Text="Page2"> </asp:MenuItem> <asp:MenuItem NavigateUrl="~/About.aspx" Text="×ĸלינו"/> </Items> </asp:Menu> 

In the above example, "Page1" and "Page 2" will drop out of "ד×Ŗ הבי×Ē". There are some good examples / explanations here on MSDN .

A fair warning, these controls can be a little complicated in style. So if you want more flexibility / control, I would suggest making your menu using CSS (and javascript if you need it) with an unordered list of HTML ( ul )

+4
source

try the following:

 <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl="~/Default.aspx" Text="ד×Ŗ הבי×Ē"> <asp:MenuItem NavigateUrl="~/Page1.aspx" Text="Page1"/> <asp:MenuItem NavigateUrl="~/Page2.aspx" Text="Page2"/> </asp:MenuItem> <asp:MenuItem NavigateUrl="~/About.aspx" Text="×ĸלינו"/> </Items> 

in another solution, the "/" in lines 4 and 5 are missing ....

+2
source

All Articles