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

Merging context menu for radGrdidView with RadContextMenu

3 Answers 81 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Czeshirecat asked on 23 Jun 2017, 01:01 PM

Hi.

RadGridView has it's own context menu that displays when right clicking the various sections of the control.

I want to merge my own context menu with it but I can't see how to do this. If I set the context menu with the context menu manager i get 2 overlapping context menus when I right click.

(radcontextmenu has no allowmerge property)

thanks.

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 26 Jun 2017, 08:06 AM
Hi Claire,

You need to add your items to the default context menu. This can be done by using the ContextMenuOpening event. An example is available here: Modifying the Default Context Menu.

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Czeshirecat
Top achievements
Rank 2
Iron
Iron
answered on 26 Jun 2017, 10:39 AM

thanks for this.

I guessed how to do it before your reply and I originally used the following code to copy the items in my design time context menu across to the default.

It worked fine when I right clicked the main area of the data grid, but if I right clicked the navigation bar, then right clicked the data grid I received an exception "Cannot remove the specified item because it was not found in the specified Collection.".

There's no error if I create the menu items every time so I believe they are disposed of behind the scenes.

private void dataGrid_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
  for (var idx = 0; idx < radContextMenu1.Items.Count; idx++)
    e.ContextMenu.Items.Add(radContextMenu1.Items[idx]);
}// function
0
Dimitar
Telerik team
answered on 26 Jun 2017, 11:00 AM
Hello Claire,

Which part you of the grid you are considering to be "navigation bar"? I have tested this with a regular grid and it works fine on my side. Are you using the context menu for other control?

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ContextMenu
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Answers by
Dimitar
Telerik team
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Share this question
or