This documentation is archived and is not being maintained.

MenuItem.Selectable Property

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

Gets or sets a value that indicates whether the MenuItem object can be selected, or is "clickable."

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

public bool Selectable { get; set; }
/** @property */
public boolean get_Selectable ()

/** @property */
public void set_Selectable (boolean value)

public function get Selectable () : boolean

public function set Selectable (value : boolean)

Property Value

true if the menu item can be selected; otherwise, false.

When this property is set to false on a menu item, no action occurs when the menu item is clicked (selected). The pop-out image indicating child menu items for the menu item, if one exists, is still shown and available.

If you do not want any child menu items to appear for a menu item, set the Enabled property to false.

The following code example demonstrates how a menu item with the Selectable property set to false appears and functions in a menu.


<%@ Page Language="VB" %>

<html>
  <body>
    <form runat="server">
    
      <h3>Menu Selectable and Enabled properties Example</h3>
    Note that Home, set to Selectable=false, is unselectable, but still shows all child items.<br />
    Movies, set to Enabled=false, is unselectable, is greyed out, and does not show child items. <br />
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical"
        target="_blank"  
        runat="server">
        
        <dynamicmenustyle backcolor="LightSkyBlue"
          forecolor="Black"
          borderstyle="Solid"
          borderwidth="1"
          bordercolor="Black" />
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Non-Selectable"
            tooltip="Non-Selectable"
              Selectable=false>
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Disabled"
              tooltip="Disabled"
              Enabled=false>
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                tooltip="Action"/>
                 
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

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


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
Show: