Represents a popup menu control.
public class ASPxPopupMenu : ASPxMenuBase
Public Class ASPxPopupMenu Inherits ASPxMenuBase
Related API Members
The following members accept/return ASPxPopupMenu objects:
Use the ASPxPopupMenu class to display a context menu in your web application. A popup menu control can be displayed, for instance, when an end-user clicks the right mouse button over a control or area of the page. The ASPxPopupMenu 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.
- Customizable appearance through themes, user-defined images, styles, and user-defined templates.
An ASPxPopupMenu 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.
A popup menu can be invoked dynamically when a specific action defined via the ASPxPopupMenu.PopupAction property is performed within a web control or HTML elements specified by the ASPxPopupMenu.PopupElementID property. Submenus of the displayed popup menu appear when the mouse pointer moves over the menu items that have children. The delay in displaying the popup menu or its submenus is controlled by the ASPxMenuBase.AppearAfter property. The popup menu or its 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 popup menu control is capable of displaying any text specified by its MenuItem.Text property, 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 ASPxPopupMenu 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 (via the ASPxMenuBase.ItemTemplate and ASPxMenuBase.SubMenuTemplate properties) and at the level of individual menu items (via the MenuItem.Template and MenuItem.SubMenuTemplate properties).
The ASPxPopupMenu 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 control's client-side equivalent is represented by the ASPxClientPopupMenu object.
- On the client side, the client object can be accessed directly by the name specified via the ASPxMenuBase.ClientInstanceName property.
- The available client events can be accessed by using the ASPxMenuBase.ClientSideEvents property.
The client-side API is always available for this control.
If you want menu items of the top menu level to be constantly displayed on a page, consider using the ASPxMenu control.