ASP.NET menu sub-items dropdown behind image

by ebarcza 8/1/2011 7:24:00 AM

Sometimes when you have menu sub-items in a .NET menu control they will be hidden behind an image if they happen to overlap. To fix this, set the z index of the dynamicMenu css class

 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="menu.ascx.cs" Inherits="YANKEE_WEB.menu" %>
<asp:Menu ID="mnuYANKEE" runat="server" DataSourceID="SiteMapDataSource1" 
            Orientation="Horizontal" ForeColor="#8D4F59" Font-Names="Arial" 
                Font-Size="Medium" Font-Bold="True" 
                StaticBottomSeparatorImageUrl="~/Images/separator.gif" 
                StaticEnableDefaultPopOutImage="False" 
                DynamicBottomSeparatorImageUrl="~/Images/Menu_bottom_sep.jpg" 
                CssClass="menumain" onprerender="mnuYANKEE_PreRender" DynamicHoverStyle-BackColor="#CCCCFF">
            <StaticMenuStyle HorizontalPadding="4px" />
            <StaticSelectedStyle ForeColor="#8D4F59" />
            <StaticMenuItemStyle HorizontalPadding="15px" />
            <DynamicHoverStyle BackColor="#cdcdcd" ForeColor="#500000" Font-Overline="False"
                                Font-Underline="false" Font-Bold="true"/>
            
            <DynamicMenuStyle BackColor="#FFFFFF" BorderColor="" CssClass="dynamicMenu" VerticalPadding="0px" HorizontalPadding="0px" />
            <DynamicMenuItemStyle Width="200px" CssClass="dynamicMenuItem" Font-Size="5pt" ForeColor="#8D4F59" />
            <StaticHoverStyle ForeColor="#500000" />
            <Items>
                <asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
            </Items>
</asp:Menu>

Now the css class for the DynamicMenuStyle

.dynamicMenu {
    text-align:left;
    padding-left:0px;
    font-size:small;
    margin-left:15px;
    margin-top:5px;
    z-index:1000;
}

Tags:

.NET

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  October 2018  >>
MoTuWeThFrSaSu
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2018

Sign in