ASPxMenuBase.AllowSelectItem Property
Gets or sets a value specifying whether items can be selected within the menu.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Remarks
Set the AllowSelectItem property to true
to enable menu item selection. If enabled, clicking on an item selects it. Otherwise, items cannot be selected. Note that only one item can be selected at the same time within a menu control if the AllowSelectItem property is set to true
.
Menu items can also be selected via code. For this purpose, use an item’s MenuItem.Selected or a menu’s ASPxMenuBase.SelectedItem property on the server side, or the ASPxClientMenuBase.GetSelectedItem/ASPxClientMenuBase.SetSelectedItem method - on the client side.
Note
If the AllowSelectItem is enabled or the ASPxMenuBase.ItemLinkMode property is not set to ItemLinkMode.ContentBounds, the state of menu items (selected - MenuItem.Selected, or checked - MenuItem.Checked) cannot be manipulated (obtained or set) on the client side either programmatically or via UI.
Example
This part of the ItemLinkMode demo illustrates how to use the ASPxMenu‘s ItemLinkMode property.
Here, two ASPxMenu controls are used with different settings for their ItemLinkMode property. The first menu’s ItemLinkMode property is set by default to ContentBounds allowing the entire area of each menu item to be clickable. The ItemLinkMode property of the second menu is set to TextOnly.
...
<dxm:ASPxMenu id="ASPxMenu1" runat="server" AllowSelectItem="True" ShowPopOutImages="True">
<Items>
<dxm:MenuItem Name="home" Text="Home"></dxm:MenuItem>
<dxm:MenuItem Name="products" Text="Products">
<Items>
...
</Items>
</dxm:MenuItem>
<dxm:MenuItem Name="downloads" Text="Downloads"></dxm:MenuItem>
<dxm:MenuItem Name="support" Text="Support"></dxm:MenuItem>
</Items>
</dxm:ASPxMenu>
...
<dxm:ASPxMenu id="ASPxMenu2" SkinID="None" runat="server" AutoSeparators="RootOnly"
ItemLinkMode="TextOnly" Font-Names="Tahoma" Font-Size="11px"
Font-Underline="False" ForeColor="#162436" SeparatorColor="#5386CB" SeparatorHeight="10px">
<Items>
...
</Items>
<Paddings Padding="0px" />
<SeparatorPaddings PaddingLeft="14px" PaddingRight="14px" PaddingTop="1px" />
<LinkStyle>
<HoverFont Underline="True" />
</LinkStyle>
</dxm:ASPxMenu>
...