The GridTreeControl provides support to the ContextMenu interactive feature that is used to show the customizable menu for performing some functions in Grid. Here, Sorting, copy and paste operations are performed using ContextMenu.
In the GridTreeControl, you can show the context menu based on some criteria with the help of QueryContextMenuInfo event. To show the context menu by using the QueryContextMenuInfo event, you need to set the EnableContextMenu to true.
You can refer to the following code example to enable the ContextMenu in the grid.
By using the QueryContextMenuInfo event, you can get the details about cells like CellValue, CellType, column index, and row index. Based on those values, you can create your own ContextMenu.
In the following code example, ContextMenu for a grid is created based on the row index in the QueryContextMenuInfo event. Refer to the following code example to add the menu items in the ContextMenu based on the rowindex.
In the QueryContextMenuInfo event, when the row index is 0 (Header row), then the SortColumn menu item is added to the ContextMenu. For the other rows, Copy and Paste menu items are added. Refer to the following code example to perform the operations on clicking the menu items in the ContextMenu by using the Commands and CommandParameter of a menu item.
On clicking the menu items, the following operations are performed.
When you open the ContextMenu in the Header row, then the ContextMenu is displayed as follows.
Figure 1: Menu Item SortColumn added to ContextMenu
When you open the ContextMenu in other rows, then the ContextMenu is displayed as follows:
Figure 2: Copy, Paste Menu Items are added to Context Menu
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:||Product Version:|
or the page will be automatically redirected to sign-in page in 10 seconds.