With Basic Styles:
<%@ Page Language="C#" %> <html> <head id="Head1" runat="server"> <style> .StaticItem { background:#eee; border:solid 1px #0f0; margin:1px; } .DynamicItem { background-color:#eee; border:solid 1px #00f; margin:1px; z-index:100; } .DynamicHighlight { background-color:Aqua; border:solid 1px #f00; } .StaticHighlight { background-color:Yellow; border:solid 1px #f00; } .DyanamicSelected { background-color:Lime; color:#fff; } .StaticSelected { background-color:Fuchsia; color:#fff; } </style> <script runat="server"> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!this.IsPostBack) for (int i = 0; i < 5; i++) { MenuItem item = new MenuItem("Item" + i); for (int j = 0; j < 5; j++) { MenuItem child = new MenuItem("Child" + j); for (int k = 0; k < 5; k++) { MenuItem grandChild = new MenuItem("Grand Child" + k); child.ChildItems.Add(grandChild); } item.ChildItems.Add(child); } this.mnuNavigation.Items.Add(item); } } </script> </head> <body> <form runat="server" id="form1"> <asp:Menu runat="server" ID="mnuNavigation" CssClass="menu"> <DynamicMenuItemStyle CssClass="DynamicItem" /> <StaticMenuItemStyle CssClass="StaticItem" /> <DynamicHoverStyle CssClass="DynamicHighlight" /> <StaticHoverStyle CssClass="StaticHighlight" /> <DynamicSelectedStyle CssClass="DyanamicSelected" /> <StaticSelectedStyle CssClass="StaticSelected" /> </asp:Menu> </form> </body> </html>
With image background.
Styles:
.StaticItem { background-image:url('Images/StaticItem.gif'); border:solid 1px #0f0; margin:1px; } .DynamicItem { background-image:url('Images/DynamicItem.gif'); border:solid 1px #00f; margin:1px; z-index:100; } .DynamicHighlight { background-image:url('Images/DynamicHighlight.gif'); border:solid 1px #f00; } .StaticHighlight { background-image:url('Images/StaticHighlight.gif'); border:solid 1px #f00; } .DyanamicSelected { background-image:url('Images/DyanamicSelected.gif'); color:#fff; } .StaticSelected { background-image:url('Images/StaticSelected.gif'); color:#fff; }
No comments:
Post a Comment