Selecting A Row On Right-Click/Context Menu Popup

3 posts, 0 answers
  1. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 10 Mar 2008 Link to this post

    In the RadControls for ASP.NET version, I was able to select a row when a user right clicked for a context menu using the ClientEvents OnRowContextMenu event:

    1 function CabinetRowContextMenu(index, e)  
    2 {  
    3      document.getElementById("radGridClickedRowIndex").value = index;  
    4      var menu = <%= rmCabinets.ClientID %>;  
    5      menu.Show(e);  
    6                   
    7      e.cancelBubble = true;  
    8      e.returnValue = false;  
    9  
    10      if (e.stopPropagation)  
    11      {  
    12           e.stopPropagation();  
    13           e.preventDefault();  
    14      }  
    15      this.SelectRow(this.Rows[index].Control, true);  
    16 }  
    17  

    I was also able to get the row index of the selected row using:
    1 rgItemCategories.MasterTableView.SelectedRows[0].Index 

    I assumed that the following was the equivalent for Prometheus:
    1 var rgCabinets = $find("<%= rgCabinets.MasterTableView.ClientID %>");  
    2 var selectedItems = rgCabinets.get_selectedItems();  
    3  
    4 selectedItems[0].get_index(); 
     
    But that doesn't seem to work and the documentation online does not have a valid page for this property/method.

    How can I achieve these 2 things?

    Seth
  2. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 11 Mar 2008 Link to this post

    I have solved this.

    1 function OnRowContextMenuFolderTypes(sender, eventArgs)  
    2 {  
    3      var rgGrid = $find("<%= rgGrid.MasterTableView.ClientID %>");  
    4      rgGrid.selectItem(eventArgs.get_itemIndexHierarchical());               
    5 }  
    6  
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 11 Mar 2008 Link to this post

    Hello Seth,

    You may also refer to this code library thread and for more examples about how to use RadMenu as context menu in RadGrid:

    http://www.telerik.com/community/code-library/submission/b311D-kmaah.aspx

    or this KB article:

    http://www.telerik.com/support/kb/article/b454K-kgt-b454T-cbb-b454c-cbb.aspx

    Best regards,
    Stephen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top