Get RadGrid cell value using Context menu

3 posts, 1 answers
  1. Fred Mare
    Fred Mare avatar
    36 posts
    Member since:
    Dec 2009

    Posted 26 Jan 2012 Link to this post


    I would like to get a radgrid cells value and controls when a context menu item is selected on the client side. How would I do this?

    Thank You
  2. Answer
    Peter avatar
    6637 posts

    Posted 27 Jan 2012 Link to this post


    You can use a client-side approach to populate the details for a row. With this online demo, try the following modifications:
    <telerik:RadContextMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick"
           EnableRoundedCorners="true" EnableShadows="true">
               <telerik:RadMenuItem Text="Quick view">
                             <div id="productName"></div>
               <telerik:RadMenuItem Text="Add" />
               <telerik:RadMenuItem Text="Edit" />
               <telerik:RadMenuItem Text="Delete" />

    function RowContextMenu(sender, eventArgs) {
                  * * *
                   sender.get_masterTableView().selectItem(sender.get_masterTableView().get_dataItems()[index].get_element(), true);
                   var selectedRow = sender.get_masterTableView().get_selectedItems()[0];
                   var productName =  sender.get_masterTableView().getCellByColumnUniqueName(selectedRow, "ProductName").innerHTML;          
                   $get("productName").innerHTML = productName;         
                  * * *

    Note, that with this approach the columns should be rendered. If you want to make them invisible, you should set their Display property to false.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. DevCraft R3 2016 release webinar banner
  4. Fred Mare
    Fred Mare avatar
    36 posts
    Member since:
    Dec 2009

    Posted 05 Feb 2012 Link to this post

    Thank you for the help
Back to Top