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

Display contextmenu

1 Answer 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sigma
Top achievements
Rank 1
Sigma asked on 10 Apr 2012, 12:35 PM
Hello,

How to display context menu at left mouse click of gridbutton. Context menu is displayed on right mouse click at grid button but i want to display it at left mouse click.

Thanks in advance.
Sigma

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Apr 2012, 01:37 PM
Hello,

Try the following code to show context menu on right click of button.
aspx:
<telerik:GridButtonColumn UniqueName="Select" Text="click" ButtonType="LinkButton"></telerik:GridButtonColumn>
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
  if (e.Item is GridDataItem)
  {
   GridDataItem item = (GridDataItem)e.Item;
   LinkButton btn = (LinkButton)item["Select"].Controls[0];
   btn.OnClientClick = "showMenu(this, event); return false;";
  }
}
JS:
function showMenu(sender, args) {
        var contextMenu = $find("<%= RadContextMenu1.ClientID %>");
        contextMenu.show(args);
}

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