This is a migrated thread and some comments may be shown as answers.

Show different right click options based on cell content

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 11 Jul 2011, 04:09 AM
I am looking to show a different context menu, based on the value of a cell when right clicking on a row. For example. I have a grid, that displays a list of emails. One of the cells in the grid is an Boolean, called isread. If the value is true, when I right click on the email. I want an option to "Mark as Unread" If the value is false, I want to display "Mark as Read" 

Any assistance in how to do this, and if it is possible would be greatly appreciated. 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jul 2011, 07:24 AM
Hello Danny,

You can attach OnRowContextMenu and show the ContextMenu based on the clicked cell index.

javascript:
function RowContextMenu(sender, eventArgs)
 {
      var menu1 = $find("<%=RadMenu1.ClientID %>");
      var menu2 = $find("<%=RadMenu2.ClientID %>");
      var cellIndex = evt.target.cellIndex;//accessing the index of cell clicked
      alert(cellIndex);
      //Show the menu based on the cell clicked.    
  }

Thanks,
Shinu.
Tags
Grid
Asked by
Danny
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or