Represents a popup menu control.
public class ASPxPopupMenu : ASPxMenuBase
Public Class ASPxPopupMenu Inherits ASPxMenuBase
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).