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

RadContextMenu in RadGridView

1 Answer 402 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris Kirkman
Top achievements
Rank 1
Chris Kirkman asked on 12 Mar 2010, 02:58 PM
1.  I've added a RAD context menu manager to my form.
2.  I've added a RAD context menu to my form.
3.  I've set the RadContextMenu property of my RadGridView appropriately.

At run time, when I right-click, I still see the default context menu and not mine. 

What gives?

Interstingly enough, I've found that my context menu DOES show up if there are no rows in my grid.  As soon as there are rows in my grid, the default context menu is displayed.


...AND THEN THERE WAS LIGHT!!!!

Ok, you must open the Property Builder for the Grid View.  Then you must select the "GridViewTemplate".  Then set the "AllowCellContextMenu" to false.  This seems pretty cheesy I must say.  Alot of work just to get the context menu that I want to be shown to be displayed.  Wouldn't one property on the grid itself be sufficient...something like "UseRadContextMenu"?

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 12 Mar 2010, 03:26 PM
Hello Chris Kirkman,

Thank you for the question.

The RadConextMenu instance that you set to RadGridView by RadConextMenuManager is available only when the default context menu is not shown. Since the default conext menu is shown where there are cell elements, you are able to show your conext menu only on the empty part of RadGridView. If you want to show your custom RadContextMenu on cells as well, just cancel the default menu in the ConextMenuOpening event:
public Form1()
{
    InitializeComponent();
  
    this.radGridView1.ContextMenuOpening += new Telerik.WinControls.UI.ContextMenuOpeningEventHandler(radGridView1_ContextMenuOpening);
}
  
void radGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
    e.Cancel = true;
}

I hope this helps. If you have additional questions, feel free to contact me.

Kind regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Chris Kirkman
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or