[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
    [Expand]Binding to Data
    [Collapse]Data Representation Basics
     [Expand]Customization Window
     [Collapse]Context Menu Overview
       Grid Context Menu Items
      Customization Dialog
    [Expand]Focus and Navigation
    [Expand]Data Editing
    [Expand]Data Shaping and Manipulation
    [Expand]Data Formatting
    [Expand]Master-Detail Relationship
     Appearance Customization
     Save and Restore Layout
    ASPxGridView Designer
   [Expand]Visual Elements
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Tree List
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Context Menu Overview

The ASPxGridView context menu is a popup menu displayed when an end-user right-clicks a grid element. The following context menu types are available.

  • Browser context menu is a browser-dependent menu allowing you to perform commands related to your browser functionality. This type of menu is displayed by default.
  • Grid context menu is a built-in context menu that provides a capability to perform the most popular grid commands (e.g., data editing, sorting). You can enable this menu by setting just one property. The menu default items can be easily shown or hidden, or supplemented with custom items.
  • Custom context menu can be provided for a grid by implementing a popup menu manually.

Expanded Browser Context Menu

The browser context menu is displayed in a grid by default. The menu appearance and content depend on an end-user's browser.

The image above provides an example of a browser's context menu. You can see that it does not relate to grid functionality and provides browser-related commands only. To provide a grid-related context menu - enable the built-in grid context menu.

It might not be required (for some reason) to display the built-in grid menu for particular elements (such as for group rows) and display the browser menu instead. This particular scenario is demonstrated in the given code.

Expanded Grid Context Menu

The grid's built-in context menu provides different context menu types for the following elements.

  • row
  • column
  • footer
  • group panel
  • group footer

To enable the grid's built-in context menu, set the ASPxGridViewContextMenuSettings.Enabled property to true.

Note that you can enable only menus of a particular type (e.g. hide the context menu for a group panel), as well as show/hide specific menu items. The corresponding properties are listed in a table below.

Custom Context Menu Items

You can populate a grid context menu with custom items using the ASPxGridView.FillContextMenuItems event. The event is raised after default context menu items are created and before the context menu is shown; and enables you to customize the item collection.

The code sample below demonstrates how to provide the default grid context menu with two custom items. To add the items to the item collection, the ASPxGridView.FillContextMenuItems event is used. On the client-side, the ASPxClientGridView.ContextMenuItemClick event is handled to respond to a custom item click.

The image below demonstrates a context menu with the custom items.

Expanded Custom Context Menu

You can provide a custom context menu for a grid by handling the ASPxClientGridView.ContextMenu event.

In the example below, the ASPxClientGridView.ContextMenu menu is handled to display a context menu when an end-user right-clicks within the column header panel.

The image below shows the result.


If the ASPxClientGridViewContextMenuEventArgs.showBrowserMenu event argument property is set to true, or a grid context menu is enabled for the current element, the custom context menu is not displayed.

Expanded How to Determine a Type of Context Menu That Will be Displayed for a Grid Element

When you enable different types of context menus for a grid, it can be difficult to determine which of the menus will be displayed for a particular element. The diagram below helps you to determine the displayed menu type.

Expanded See Also

Is this topic helpful?​​​​​​​