Skip to main content

ASPxMenuBase.SelectedItem Property

Gets or sets the selected menu item within a menu control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web


public MenuItem SelectedItem { get; set; }

Property Value

Type Description

A MenuItem object representing the selected item.


If the ASPxMenuBase.AllowSelectItem property is set to true, end users are allowed to select menu items via mouse clicks. A menu control (which can be either the ASPxMenu or ASPxPopupMenu) also provides the ability to select its items via code. You can use the SelectedItem property on the server side for this purpose.

Note that only one menu item can be selected within a menu control at the same time, and this item is displayed selected only if the menu’s ASPxMenuBase.ItemLinkMode property is set to the ItemLinkMode.ContentBounds value.

If none of the items is selected within a menu control or selecting is prohibited, the SelectedItem property returns null (Nothing in Visual Basic).

The selected state of an individual menu item can be specified by its MenuItem.Selected property.


The code sample below demonstrates how to populate an ASPxMenu control with items manually, in unbound mode. The image below shows the result.


protected void Page_Load(object sender, EventArgs e)
     if (!IsPostBack) {

//Create Menu initial structure. 
void CreateMenu() {
     string[] Items = { "Home", "News", "Products", "Client Center" };
     foreach (string ItemText in Items) {
     MenuItem[] ProductsItems = { 
          new MenuItem("Downloads"), 
          new MenuItem("Support"), 
          new MenuItem("Order") 

//Add a new item
protected void btnAddItem_Click(object sender, EventArgs e) {
     if ((MyMenu.SelectedItem != null) && (tbItemName.Text != "")) {
See Also