CompositeControl encapsulating the Ajax-enabled RadMenu as context menu in RadGrid functionality

Thread is closed for posting
1 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 10 May 2007 Link to this post



    RadGrid, RadMenu, RadAjax
    Telerik.Web.UI 2007.3.12.18+
    .NET version

    2.x, 3.x
    Visual Studio version

    programming language

    C# / VB.NET
    browser support

    all browsers supported by RadControls

  2. HOW-TO
    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.
  • Back to Top

    This Code Library is part of the product documentation and subject to the respective product license agreement.