Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Menu > Get RadGrid cell value using Context menu

Answered Get RadGrid cell value using Context menu

Feed from this thread
  • Fred Mare avatar

    Posted on Jan 26, 2012 (permalink)

    Hi

    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
    Fred

    Reply

  • Answer Peter Peter admin's avatar

    Posted on Jan 27, 2012 (permalink)

    Hi,

    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">
           <Items>
               <telerik:RadMenuItem Text="Quick view">
                   <Items>
                       <telerik:RadMenuItem>
                           <ItemTemplate>
                             <div id="productName"></div>
      
                           </ItemTemplate>
                       </telerik:RadMenuItem>
                   </Items>
               </telerik:RadMenuItem>
               <telerik:RadMenuItem Text="Add" />
               <telerik:RadMenuItem Text="Edit" />
               <telerik:RadMenuItem Text="Delete" />
           </Items>
       </telerik:RadContextMenu>


    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;         
      
                   menu.show(evt);
      
                  * * *
               }


    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.

    Greetings,
    Peter
    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

    Reply

  • Fred Mare avatar

    Posted on Feb 5, 2012 (permalink)

    Thank you for the help

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Menu > Get RadGrid cell value using Context menu
Related resources for "Get RadGrid cell value using Context menu"

[  ASP.NET Menu Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]