This online demo illustrates how to use header context menu in RadGrid for ASP.NET
AJAX. It is quite useful if you would like to process operations like sorting or
grouping on a per-column basis or show/hide some of the grid columns based on the
end user preferences. This is very convenient when you want to utilize context menu
for this purpose (in addition to the default sorting/grouping capabilities of RadGrid)
or modify the columns visibility in real time.
The header context menu exposes the following default options:
- Sort the right-clicked column in ascending/descending/none order
- Group/ungroup the right-clicked column in case the grouping feature of the control is enabled
- Show/hide grid columns client-side by changing the state of the checkboxes beside
each column name (to see drill down to the second menu group under the 'Columns'
option)
This context menu can be enabled by setting the
EnableHeaderContextMenu
property of the corresponding table to
true (the default value
is false). The menu is designed on a per-table level and can be switched on/off
for different levels in hierarchical grid on demand (in the example the header context
menu is disabled for the second level in the hierarchy).
Note that the items from the menu will displayed dynamically depending on the grid
configuration, i.e. if the grouping feature is disabled the 'Group By'/'Ungroup'
options will be hidden, or if you choose natural sorting the 'Clear Sorting' item
will be absent.
Further information about this RadGrid for ASP.NET AJAX feature can be found in
the online documentation:
Header context menu