Standard Example Menu : MenuItem « Asp Control « ASP.Net






Standard Example Menu

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Menu ID="Menu1" runat="server" Orientation="Horizontal">
    <Items>
        <asp:MenuItem Text="Item 1" Value="Item 1">
            <asp:MenuItem Text="Subitem 1" Value="Subitem 1"></asp:MenuItem>
            <asp:MenuItem Text="Subitem 2" Value="Subitem 2"></asp:MenuItem>
            <asp:MenuItem Text="Subitem 3" Value="Subitem 3"></asp:MenuItem>
        </asp:MenuItem>
        <asp:MenuItem Text="Item 2" Value="Item 2">
            <asp:MenuItem Text="Subitem 1" Value="Subitem 1"></asp:MenuItem>
            <asp:MenuItem Text="Subitem 2" Value="Subitem 2"></asp:MenuItem>
            <asp:MenuItem Text="Subitem 3" Value="Subitem 3"></asp:MenuItem>
            <asp:MenuItem Text="Subitem 4" Value="Subitem 4"></asp:MenuItem>
        </asp:MenuItem>    </Items>
        <StaticMenuStyle BackColor="#EEEEEE" 
                         BorderColor="#CCCCCC" 
                         BorderStyle="Solid" 
                         BorderWidth="1px"
                         HorizontalPadding="4px" 
                         VerticalPadding="4px" />
        <StaticMenuItemStyle BackColor="#EEEEEE" ForeColor="Black" ItemSpacing="8px" />
        <StaticHoverStyle BackColor="#000000" ForeColor="White" />
        <DynamicHoverStyle BackColor="#EEEEEE" />
        <DynamicMenuStyle BackColor="#EEEEEE" 
                          BorderColor="#CCCCCC" 
                          BorderStyle="Solid" 
                          BorderWidth="1px" />
        <StaticSelectedStyle BackColor="#EEEEEE" />
        <DynamicMenuItemStyle BackColor="#EEEEEE" 
                              BorderColor="#CCCCCC" 
                              BorderStyle="Solid"
                              BorderWidth="1px" 
                              ForeColor="Black" 
                              HorizontalPadding="4px" 
                              VerticalPadding="4px" />
    </asp:Menu>
    
    </div>
    </form>
</body>
</html>

 








Related examples in the same category

1.Programmatic MenuItems
2.Set SeparatorImageUrl