Disable Header right click

6 posts, 1 answers
  1. Surendar S
    Surendar S avatar
    33 posts
    Member since:
    Nov 2009

    Posted 05 Jan 2011 Link to this post

    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
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 05 Jan 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Surendar S
    Surendar S avatar
    33 posts
    Member since:
    Nov 2009

    Posted 05 Jan 2011 Link to this post

    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.
  5. Gabriela
    Gabriela avatar
    9 posts
    Member since:
    Sep 2008

    Posted 04 May 2011 Link to this post

    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.
  6. Taha
    Taha avatar
    2 posts
    Member since:
    Feb 2012

    Posted 07 Aug 2012 Link to this post

    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
  7. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 09 Aug 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready