ContextMenu over a specified column in RadGrid

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

    Posted 05 Mar 2008 Link to this post


    RadControls version

    RadContextMenu, RadGrid 
    Telerik.WEB.UI 2007.3.1425

    .NET version


    Visual Studio version


    programming language

    C#, VB

    browser support

    all browsers supported by RadControls

    This project shows how to open a context menu (RadContextMenu) only if you click on a cell in the first column.
    This is achieved by hooking on the OnRowContextMenu client event of the Grid.

         <ClientEvents OnRowContextMenu="RowContextMenu" /> 
         <Selecting AllowRowSelect="true" /> 

    Here is the JavaScript function that invokes the context menu:

    <script type="text/javascript">  
    function RowContextMenu(sender, eventArgs)  
       var menu = $find("<%= RadContextMenu1.ClientID %>");  
       var domEvent = eventArgs.get_domEvent();  
       var source = || domEvent.srcElement;  
       var index = eventArgs.get_itemIndexHierarchical();  
       var masterTable = sender.get_masterTableView();  
       //select the current row  
       //get the first cell of the row  
       var cell = masterTable.get_dataItems()[index].get_element().cells[0];      
       if (source == cell)  
  • Back to Top

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