|Visual Studio version
all browsers supported by RadControls
Use an Ajax-enabled RadMenu as context menu in RadGrid with out using the GridEditCommandColumnDESCRIPTION
This code library extends the approach demonstrated in the Ajax-enabled RadMenu as context menu in RadGrid knowledge base article using only the RadMenu for the Add / Edit, Save / Cancel functionality.
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/save/cancel). Furthermore, you may prefer the operation with asynchronous request instead of postback. SOLUTION
Basically what we do is:
- First, we need to display the RadMenu in the to-be-inserted row, we can do that adding an Attribute to the insert row in the PreRender event of the RadGrid.
- Second we consume the client event OnRowContextMenu and based on the index and the ItemType property of the RadGridTableRow object we show or hide the RadMenuItems (when the index is -1 we are talking about a insert row)
- Finally, inside the handler (the ItemClick event handler of RadMenu) perform the corresponding task chosen by the user to modify the item state