CompositeControl encapsulating the Ajax-enabled RadMenu as context menu in RadGrid functionality
Thread is closed for posting
Posted 10 May 2007
Link to this post
RadGrid, RadMenu, RadAjax
|Visual Studio version
C# / VB.NET
all browsers supported by RadControls
Build a CompositeControl that encapsulates the Ajax-enabled RadMenu as context menu in RadGrid functionality.
This code library builds over the approach demonstrated in the Ajax-enabled RadMenu as context menu in RadGrid knowledge base article but encapsulates the implementation in a CompositeControl for easier deployment.
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 RadMenu, RadAjax and RadGrid makes this task very easy to be accomplished. Our grid control exposes OnRowContextMenu client event which can be handled to obtain reference to the client object of RadMenu/RadContextMenu and call its show method (passing event argument as parameter). In order to determine the index of the clicked row on the server, you can use a hidden field on the page to store its value client side and then operate with it on form submit (inside the ItemClick event handler of RadMenu). Inside the handler perform the corresponding task chosen by the user to modify the item state.
Finally, configure the ajax manager settings in order to refresh the grid and the menu in a codeless manner.