Search code examples
asp.netmenuitemsubmenu

asp.net submenu not popups when I hover on menuitem


I have experienced such problem in asp.net. (visual studio 2008) net 3.5 I've created menu

 <div>
    <asp:Menu ID="Menu1" runat="server" 
    Orientation="Horizontal"
    BackColor="#F7F6F3" 
    DynamicHorizontalOffset="2" 
    Font-Names="Verdana" 
    Font-Size="0.8em" 
    ForeColor="#7C6F57"
    StaticSubMenuIndent="10px">

         <Items>
            <asp:MenuItem Text="Item 1">
                <asp:MenuItem Text="Sub Menu 1"></asp:MenuItem>
                <asp:MenuItem Text="Sub Menu 2"></asp:MenuItem>
            </asp:MenuItem>
            <asp:MenuItem Text="Item 2">
                <asp:MenuItem Text="Sub Menu 1"></asp:MenuItem>
                <asp:MenuItem Text="Sub Menu 2"></asp:MenuItem>
                <asp:MenuItem Text="Sub Menu 3">
                    <asp:MenuItem Text="Sub Sub Menu 1"></asp:MenuItem>
                    <asp:MenuItem Text="Sub Sub Menu 2"></asp:MenuItem>
                </asp:MenuItem>
            </asp:MenuItem>
            <asp:MenuItem Text="Item 3"></asp:MenuItem>
            <asp:MenuItem Text="Item 4"></asp:MenuItem>
        </Items>

       <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
        <DynamicMenuStyle BackColor="#F7F6F3" />
        <DynamicSelectedStyle BackColor="#5D7B9D" />


        <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
        <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
        <StaticSelectedStyle BackColor="#5D7B9D" />
    </asp:Menu>

When I run web page, menu appears, but when I hover on parent menuitem, submenues not popups. Instead when I click on menuitem the only submenu level is shown and "one level up" link is displayd. How to achieve, popup of submenues?


Solution

  • The default behavior of the ASP.NET menu control is to display the sub menu items on hover.If this is not happening it means that you have some sort of javascript or css on your page which is over riding the default bahavior.

    What I suggest is to create a blank .aspx page and add your menu mark up to this page.Don't add ANY javascript or css files to this page, run the new page in the browser and you will see that it works.Now slowly start adding the javascript files and css style rules to the page until the menu sub item displaying stops working.Hopefully this will help you identify the problem.