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

Disable Header right click

5 Answers 681 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Surendar S
Top achievements
Rank 1
Surendar S asked on 05 Jan 2011, 08:16 AM
HI,
    I am using the Rows drag and drop functionality in my grid. I have set the "Allow Column Header Context Menu" as 'False'. But i was able to get the context menu with the contents "Conditional Formatting,Column Chooser,Hide Column,Pinned State, Best Fit". How should i hide this?.

With Regards,
S Surendar

5 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 05 Jan 2011, 08:24 AM
Hello Surendar,

I would suggest checking again the property you mentioned because in my tests (latest version) it is not showing the column header context menu once that has been set to false, but if that does not work for you, you can just register to the ContextMenuOpening event and cancel when the provider is the GridHeaderCellElement.

void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider is GridHeaderCellElement)
    {
        e.Cancel = true;
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Surendar S
Top achievements
Rank 1
answered on 05 Jan 2011, 09:31 AM
Hi Emanuel,
    Its working for me. I find the issue to be strange. What i did is i triggered the radGridView1_ContextMenuOpening event and no code was written there and i have not changed the property "Allow Column Header Context Menu" from 'False'.Now it is working for me. Then i removed the radGridView1_ContextMenuOpening event from the code and now also it works fine.I dont know why strange things are happennning here.Thank you.

With Regards,
S Surendar.
0
Gabriela
Top achievements
Rank 1
answered on 04 May 2011, 07:29 PM
Nevermind my previous post (edited here).  I was mistaken, the event was firing and your code does work.  The issue was because I had other code above it that was returning from the subroutine and thus your example code was never getting reached.  Sorry.
0
Taha
Top achievements
Rank 1
answered on 07 Aug 2012, 09:15 AM
Hi every body!
i want to active right click in rad grid view , so i don't have problem and i added
but when i want to use it , my right click and default right click are shown and it is not good
i want show just my right click and disable default right click in rad grid view
please help me
tnx
0
Stefan
Telerik team
answered on 09 Aug 2012, 02:13 PM
Hi Taha,

Please refer to the following help article which demonstrates how to replace the default context menu with your own: http://www.telerik.com/help/winforms/gridview-context-menus-custom-context-menus.html.

I hope this helps
 
Kind regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Surendar S
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Surendar S
Top achievements
Rank 1
Gabriela
Top achievements
Rank 1
Taha
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or