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

Disable context menu when editing cell

5 Answers 140 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yariv
Top achievements
Rank 1
Yariv asked on 14 Jun 2013, 03:47 PM
Hi,

I've created a grid with one editable column.
Can you please advise how I can totally disable context menu that becomes accessable when editing, or disable some specific menu points (e.g. "Insert Unicode control character", "Right to left Reading order" etc.)?

Thanks in advance.

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 Jun 2013, 09:54 AM
Hello Yariv,

Thank you for writing.

Most of our editors internally host the standard TextBox control, thus the context menu that you are seeing is the standard TextBox context menu. To remove it, you need to access this text box and set its ContextMenu property to a new instance of ContextMenu. To access the TextBox, you need to access the editor for the edited cell. Assuming that you have GridViewTextBoxColumn, the cells in this column use RadTextBoxEditor. To access the editor you need to subscribe to the CellEditorInitialized event. Here is a sample:
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadTextBoxEditor editor = e.ActiveEditor as RadTextBoxEditor;
 
    if (editor != null)
    {
        ((RadTextBoxEditorElement)editor.EditorElement).TextBoxItem.HostedControl.ContextMenu = new ContextMenu();
    }
}

I hope that you find this information useful.
 
Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
0
Yariv
Top achievements
Rank 1
answered on 01 Jul 2013, 08:09 AM
Hi Stefan,

Thanks a lot, it helped!
0
Alexander
Top achievements
Rank 1
answered on 17 Sep 2013, 07:14 AM
It works for string type, but if column fill with int elements
it doesn't help.
What type instead RadTextBoxEditor I need use for INT?
0
Alexander
Top achievements
Rank 1
answered on 17 Sep 2013, 07:37 AM
Oh! I find it: GridSpinEditor)
0
Nikolay
Telerik team
answered on 18 Sep 2013, 08:33 AM
Hello Alexander,

Indeed, GridSpinEditor is the editor that you need when working with numbers. I am glad that you managed to find the answer and your case is resolved.

Regards,
Nikolay
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Yariv
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Yariv
Top achievements
Rank 1
Alexander
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or