This example demonstrates RadGrid's header context filter menu which is a sub-part
or RadGrid's header context menu and can be switched on/off using RadGrid.EnableHeaderContextFilterMenu
or GridTableView.EnableHeaderContextFilterMenu properties. In addition,
there are two indispensable prerequisites for the new filtering feature to be available:
- the column filtering has to be switched on through AllowColumnFiltering
- the header context menu must be enabled through EnableHeaderContextMenu
The new filter menu offers the power for filtering the grid's data on two conditions
related with a logical AND operator. Two additional properties have been introduced
into the GridColumn type in order to support the second filter condition data:
When a filter command is triggered from the header context filter menu, RadGrid will fire the RadGrid.HeaderContextMenuFilterCommand,
raise the ItemCommand event and send into the event handlers the filter data through the event arguments object.
Additionally, in numerous cases you may want to display a context menu when right-clicking an
arbitrary row in RadGrid. Through a command from that context menu you may want
to change the state for the grid row (for example edit/delete/add record). Furthermore,
you may prefer the operation with asynchronous request instead of postback.
The seamless integration between RadContextMenu, RadAjax and RadGrid makes this
task very easy to be accomplished. Our grid control exposes OnRowContextMenu
client event which can be handled to select the right-clicked record in the grid
to mark it as active for the current action. In order to determine the index of
the clicked row on the server, use a hidden field on the page to store its value
client side and then operate with it on form submit (in the ItemClick
event handler of RadMenu). Inside the handler perform the corresponding task chosen
by the user to modify the item state.
To associate the context menu with the grid instance, attach the OnRowContextMenu
client event of RadGrid, get reference to the context menu object client-side and
invoke its show method (passing the browser's event argument as
Finally, configure the ajax manager settings in order to refresh the grid and the
menu in a codeless manner.
- RadGrid's header context menu can be shown either:
- on mouse right-click over a header cell
- or by left-clicking on an element that fires a client-side method of RadGrid's, showing the context menu (see the ShipCity
- RadGrid's row context menu can be shown by right clicking on each data row.