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

ContextMenuStrip on RadGridView

7 Answers 827 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mickaël
Top achievements
Rank 1
Mickaël asked on 12 Jul 2018, 01:18 PM

Hello,

I had an project from Visual Studio 2013 and When i click with right button mouse, it appear the ContextMenuStrip, so now, with VS 2017, I need to modify the project (Another PC with VS 2017 having Telerik extensions ) but now it doesn't appear the ContextMenuStrip on RadGridView component, but on RadGridView property I have ContextMenuStrip set to the right component, but it doesn't appear. Why?

Can anyone help me?

Thank you

7 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Jul 2018, 08:25 AM
Hello, Mickaël,    

RadGridView provides a straightforward way to use custom context menus, instead of the default one. This context menu will appear every time the user right-clicks the RadGridView, regardless of the element of the control they click. I would recommend you to have a look at the following help articles which are quite useful on this topic:
https://docs.telerik.com/devtools/winforms/gridview/context-menus/custom-context-menus
https://docs.telerik.com/devtools/winforms/gridview/context-menus/modifying-the-default-context-menu

I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Mickaël
Top achievements
Rank 1
answered on 13 Jul 2018, 09:22 AM

Hello Dess,

Thank you for answer my question and thank you for the help, I see it doesn't work with a default context menu anymore, so I following the articles! It worked without problem.

Best regards,

Mickaël

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Jul 2018, 11:02 AM
Hello, Mickaël,    

The ContextMenuStrip is shown when you right-click the grid outside the area with the cells. For the grid cells it is used the grid's context menu as it is demonstrated in the referred help article from my previous post.

I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Mickaël
Top achievements
Rank 1
answered on 13 Jul 2018, 11:17 AM

Hello Dess,

Well, I tested and what you said is true! It shown me outside the area, but before I changed the PC and I have used Visual Studio 2013, it shown me inside the area with the cells with the ContextMenuStrip. Only yesterday I saw it cant work anymore when I try to update the project. Why? Components's class was updated or...? Just for curiosity.

Best regards,
Mickaël

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Jul 2018, 11:35 AM
Hello, Mickaël,    

In order to show the ContextmenuStrip it is necessary to completely disable the context menu of RadGridView. This is achieved by setting the AllowCellContextMenu and AllowColumnHeaderContextMenu properties to false of RadGridView. Then, assign the desired ContextMenuStrip

this.radGridView1.ContextMenuStrip = this.contextMenuStrip1;
radGridView1.AllowCellContextMenu = false;
radGridView1.AllowColumnHeaderContextMenu = false;

However, have in mind that the style of RadGridView and the ContextmenuStrip will be different.

I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Mickaël
Top achievements
Rank 1
answered on 13 Jul 2018, 02:56 PM

Hello Dess,

Sorry I forgot to say that I'm using VBnet now to build the project but using the VBnet's code work as well with that properties you mentioned!

radGridView.ContextMenuStrip = ContextMenuStrip1

(I attached the printscreen)

That was very simples to use!

Thank you so much!

Best regards,
Mickaël Gomes

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Jul 2018, 08:30 AM
Hello, Mickaël,    

I am glad that the suggested solution was suitable for your case. You can find below the relevant VB.NET code snippet for you reference:
Me.RadGridView1.AllowColumnHeaderContextMenu = False
Me.RadGridView1.AllowCellContextMenu = False
Me.RadGridView1.ContextMenuStrip = Me.ContextMenuStrip1

I hope this information helps. If you have any additional questions, please let me know.  
 
Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Mickaël
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Mickaël
Top achievements
Rank 1
Share this question
or