MenuItem::Selectable Property

 

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:
[BrowsableAttribute(true)]
property bool Selectable {
	bool get();
	void set(bool value);
}

Property Value

Type: System::Boolean

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.

Selectable applies only to menu items that can be selected, in the sense that clicking a menu item posts back and sets that item in the selected state. Note that a menu item that cannot be selected is still formatted as a link. This is for accessibility reasons, so that the menu item can cause an action to occur. Also, a menu item, even if it cannot be selected, may have child menu items that can be selected or that need to be displayed.

If you want to prevent a user from clicking a menu item, do one of the following:

  • Do not set NavigateUrl and set Selectable to false.

  • Set the menu item's Enabled property to false.

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

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: