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 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 menuType property);
Prevent the context menu from being displayed (use the 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.