System.Web.UI.WebControls Namespace Menu Class
.NET Framework version 2.0
Returns a MenuItemStyleCollection object that contains the style settings that are applied to the selected menu item based on its level in a Menu control.
Inline |
<asp:menu levelselectedstyles = value ... > |
Script |
Menu.LevelSelectedStyles [ = value ] |
value |
A reference to the MenuItemStyleCollection that contains the style settings that are applied to the selected menu item based on its level in a Menu control. |
The property is read/write with no default value.
Use the LevelSelectedStyles collection as an alternative to the DynamicSelectedStyle and StaticSelectedStyle properties to control the style of a selected menu item at the individual levels of the menu.
The styles contained in this collection are applied to a selected menu item based on its menu level. The first style in the collection corresponds to the style of a selected menu item in the first level of the menu. The second style in the collection corresponds to the style of a selected menu item in the second level of the menu, and so on.
This collection is most often used to generate table of contents-style navigation menus where menu items at a certain level should have the same appearance, regardless of whether they have submenus.
NOTE: If a style is defined for a certain level using the LevelSelectedStyles collection, this overrides any selected menu item style settings for the menu items at that level.
The following example demonstrates how to use the LevelSelectedStyles collection to apply a style setting to the selected menu item in a Menu control based on its level.
<asp:menu id = "navigationMenu"
staticdisplaylevels=2
staticsubmenuindent=10
orientation = "Vertical"
target = "_blank"
runat = "server">
<levelmenuitemstyles>
<asp:menuitemstyle BackColor = "LightSteelBlue"
forecolor = "Black"/>
<asp:menuitemstyle BackColor = "SkyBlue"
forecolor = "Black"/>
<asp:menuitemstyle BackColor = "LightSkyBlue"
forecolor = "Black"/>
</levelmenuitemstyles>
<levelselectedstyles>
<asp:menuitemstyle BackColor = "Cyan"
forecolor = "Gray"/>
<asp:menuitemstyle BackColor = "LightCyan"
forecolor = "Gray"/>
<asp:menuitemstyle BackColor = "PaleTurquoise"
forecolor = "Gray"/>
</levelselectedstyles>
<items>
...
</items>
</asp:menu>
Menu Members LevelMenuItemStyles LevelSubMenuStyles