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

Note: This class is new in the .NET Framework version 2.0.

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

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#" %>

<html>
  <body>
    <form 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 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

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

Community Additions

Show:
© 2014 Microsoft