Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Context Menu Customization

 

The DevExpress ASP.NET Spreadsheet (ASPxSpreadsheet) enables you to programmatically customize its context menu. By handling the PopupMenuShowing client-side event, you can perform the following actions with the ASPxSpreadsheet's context menu:

  • Manipulate menu items - add new items, remove or disable existing ones (use the e.menuItems property);
  • Identify a worksheet element (e.g., a cell, row or column header, chart or picture) for which the context menu is invoked (use the e.menuType property);
  • Prevent the context menu from being displayed (use the e.cancel property).

This demo illustrates how to implement a custom context menu and display it only for certain sheet cells (these cells are highlighted with the gray background color in the demo). The context menu is dynamically populated in the PopupMenuShowing client event with custom menu items depending upon the type of data contained within cells (such as the weight, currency or discount values). The custom menu items are implemented as new items containing custom command names. Clicks on the custom menu items with custom command names are processed by using the CustomCommandExecuted client event. Within its handler, the activated custom command is identified and the corresponding action is performed either on the client side or through a callback to the server. For instance, commands for the weight and currency conversions are performed right on the client side and display a hint (ASPxHint) with converted values; and a command for getting information on how discounts are calculated requires sending a callback to the server to obtain additional information.

Give the demo a try and see what particular context menu is displayed for different worksheet elements.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
Open VB Solution
The source code files for this demo are installed (by default) in the following directories:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\ASPxSpreadsheetDemos
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\VB\ASPxSpreadsheetDemos