Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SubMenuStyleCollection Class

Represents a collection of SubMenuStyle objects in a Menu control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public class SubMenuStyleCollection : StateManagedCollection
public class SubMenuStyleCollection extends StateManagedCollection
public class SubMenuStyleCollection extends StateManagedCollection
Not applicable.

The SubMenuStyleCollection class is used to store and manage a collection of SubMenuStyle objects in a Menu control. The Menu control uses the SubMenuStyleCollection class as the underlying data type of the LevelSubMenuStyles property.

The LevelSubMenuStyles property provides additional style choices in addition to the StaticMenuStyle and DynamicMenuStyle properties. The first style in the SubMenuStyleCollection collection corresponds to the submenu style for the first level of the menu. The second style in the collection corresponds to the submenu style for the second level of the menu, and so on. The LevelSubMenuStyles property is most often used to generate a navigation menu, like a Web site map, where menu items at a certain level should have the same appearance, regardless of whether they have submenus.

The SubMenuStyleCollection class inherits most of its members from the StateManagedCollection class. For more information on the inherited members, see the StateManagedCollection collection.

The following example demonstrates how to use the SubMenuStyleCollection class to specify the style settings for the submenus in a Menu control based on the submenu's level. In this example, the LevelSubMenuStyles property returns a SubMenuStyleCollection object.


<%@ 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">
    <title>Menu LevelSubMenuStyles</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu LevelSubMenuStyles</h3>

      <asp:menu id="NavigationMenu"
        staticdisplaylevels="3"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"  
        runat="server">
        
        <levelsubmenustyles>
          <asp:submenustyle backcolor="LightSteelBlue"
            forecolor="Black"/>
          <asp:submenustyle backcolor="SkyBlue"
            forecolor="Gray"/>          
        </levelsubmenustyles>  
      
        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>


System.Object
   System.Web.UI.StateManagedCollection
    System.Web.UI.WebControls.SubMenuStyleCollection

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft