A newer version of this page is available. Switch to the current version.

ASPxMenu Class

Represents a menu control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll


public class ASPxMenu :
Public Class ASPxMenu
    Inherits ASPxMenuBase

Related API Members

The following members accept/return ASPxMenu objects:


Use the ASPxMenu class to display a menu in your web application. A menu control can be used in combination with a site map data source control (for instance, the ASPxSiteMapDataSource) for navigating a Web site. The ASPxMenu control supports the following common features:

  • Data binding that allows the control's menu items to be bound to hierarchal data sources.
  • Programmatic access to the menu object model, to dynamically create menu items, populate them with sub-items, set properties, and so on.
  • Programmatic access to the menu client-side object model to perform specific client actions with menu items.
  • An ability to perform round-trips to the server, using the AJAX-based callback technology.
  • Customizable appearance through themes, user-defined images, styles, and user-defined templates.


An ASPxMenu control is made up of a tree of menu items represented by MenuItem objects. Menu items at the top level (level 0) are called root menu items. A menu item that has a parent menu item is called a child menu item. All root menu items are stored in the menu control's ASPxMenuBase.Items collection. Child menu items are stored in the parent menu item's MenuItem.Items collection. This enables you to create a hierarchical menu structure of any complexity. The root menu items are always displayed within the menu control. Sub-menus appear when the mouse pointer moves over menu items that have children. The delay in displaying submenus is controlled by the ASPxMenuBase.AppearAfter property. Submenus automatically disappear after a certain duration, specified by the ASPxMenuBase.DisappearAfter property, or when an end-user clicks outside of the menu.

Each item of a menu control is capable of displaying any text specified by its MenuItem.Text property, an item image, which can be defined via the MenuItem.Image property and a tooltip text set via the MenuItem.ToolTip property. The response of items to end-user clicks can be specified in two ways:

  • Specify the MenuItem.NavigateUrl property of an item. In this instance, the browser will navigate to the specified linked page when an item is clicked. By default, a linked page is displayed in the same window or frame as the menu control. To display the linked content in a different window or frame, use the menu's ASPxMenuBase.Target property.
  • Handle the clicks on menu items via specific events, in order to process them either on the server or client depending upon the menu control's ASPxMenuBase.AutoPostBack property setting.

The appearance style of all links within the menu control can be defined via the ASPxMenuBase.LinkStyle property. In order to control the clickable area of items, the ASPxMenuBase.ItemLinkMode property can be used.

The visibility and the visual order of menu items within their menus (submenus) can be controlled by the MenuItem.Visible and MenuItem.VisibleIndex properties of item objects.

The ASPxMenu control offers you complete customization of root items, child items and submenu styles (for instance, see the ASPxMenuBase.ItemStyle, ASPxMenuBase.SubMenuItemStyle and ASPxMenuBase.SubMenuStyle properties). Moreover, you can use the template technology to get unlimited control over the contents of items and submenus. You can specify the corresponding templates at the level of the menu control (see the ASPxMenuBase.ItemTemplate and ASPxMenuBase.SubMenuTemplate properties) and at the level of an individual menu item (see the MenuItem.Template and MenuItem.SubMenuTemplate properties).

The ASPxMenu control can be bound to any hierarchical data source by using its ASPxHierarchicalDataWebControl.DataSourceID or ASPxDataWebControlBase.DataSource property. Note that during data binding specific ASPxMenuBase.ItemDataBound events are generated, that allow you to dynamically map properties of the menu's items to the required data fields of the bound data source.


The ASPxMenu control provides you with a comprehensive client-side functionality, implemented using JavaScript code (see DevExpress.Web.Scripts to learn more):

The control's client-side API is enabled if the ASPxMenuBase.EnableClientSideAPI property is set to true, or the ASPxMenuBase.ClientInstanceName property is defined, or any client event is handled.

If you want your menu control to appear when certain conditions are met, instead of being constantly displayed, consider using the ASPxPopupMenu control.

See Also