Free Trial Buy Now

Menu - Client-Side Functionality

Visa
MasterCard
Union
American Express
Maestro
v

Description

This example demonstrates how to manipulate a menu control programmatically on the client using our extended client-side functionality. The client-side programmatic interface is available if the EnableClientSideAPI property is set to true or if there is a handler assigned to any client-side event.

In this demo, each item of the menu control is identified using its Name property. In order to obtain a specific menu item by its name on the client side the GetItemByName method is used. A particular menu item can be selected with the help of the SetSelectedItem method by passing it the required item. Look at the code of the InitMenu function (see JS code) which handles the client-side Init event of the menu control. This handler defines the initially selected menu item (Visa) within the menu.

In the code of the ShowProperties function (see JS code), the selected menu item is obtained with the help of the GetSelectedItem function and information on the selected menu item's index and name is displayed.

The MenuItemClick function that is a handler of the menu's ItemClick event (see ASPX and JS code) demonstrates how to synchronize the dropdown editor's value with the name of the clicked menu item.

Note that an individual client object can be referenced either directly by its ID (for instance, by using the following code: ASPxMenu1.GetItemCount()) or by using the Get method of a common collection for our ASPx web controls (this can be useful when our web control is contained within a UserControl or MasterPage; that is when the resulting client ID is generated by a specific NamingContainer). The GetMenu function (see JS code) demonstrates how to access a client menu object via our control collection.

Version: v2012 vol 2.8
Experience the DevExpress Difference Today
Demos with source code are included with an installation of DevExpress controls for ASP.NET. Refer to the Demos and Sample Applications topic to learn more.
To download your free evaluation copy of our award-winning ASP.NET libraries, visit the Downloads page
All DevExpress ASP.NET Controls ship as part of DXperience ASP.NET, Enterprise, and Universal.
To obtain pricing information, visit the Pricing Options page or contact us via Email at info@devexpress.com
or by telephone at +1 (818) 844-3383 between 8:30am and 5pm Pacific Time.