Disable default context menu for RadGridView

4 posts, 0 answers
  1. Jeff Fillegar
    Jeff Fillegar avatar
    1 posts
    Member since:
    Jul 2009

    Posted 16 Nov 2009 Link to this post

    How can you disable the default context menu for the RadGridView?  We already have our right-click context menu control added to the form and have it working with the RadGridView; however, the default context menu is displayed behind it.  I would imagine it is very easy to disable I just haven't found out how to.

    Thanks in advance.
  2. Svett
    Svett avatar
    728 posts

    Posted 18 Nov 2009 Link to this post

    Hi Jeff Fillegar,

    Thank you for contacting us and for your question.

    In order to replace the default RadGridView context menu with yours, you should subscribe to the ContextMenuOpening event, where the Cancel property of ContextMenuOpeningEventArgs should be set to false.

    public Form()
      this.radGridView.ContextMenuOpening += new ContextMenuOpeningEventHandler(radGridView_ContextMenuOpening);
    private void radGridView_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        e.Cancel = true;

    private void Form_Load(object sender, EventArgs e)
       this._menu = new ContextMenu();
       this._menu.MenuItems.Add("Item 1");
       this._menu.MenuItems.Add("Item 2");
       this.radGridView1.ContextMenu = this._menu;

    If you have other questions, feel free to contact us again.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Michael
    Michael avatar
    33 posts
    Member since:
    Nov 2014

    Posted 08 Apr 2019 in reply to Svett Link to this post

    I know this post is 9 years old, but you say to set Cancel to "false", but the code shows true.
  4. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3573 posts

    Posted 11 Apr 2019 Link to this post

    Hello, Michael,    

    I believe this is a typo. If you want to prevent the default context menu from showing it is necessary to be canceled by setting the ContextMenuOpeningEventArgs.Cancel property to true as it was demonstrated in Svetlin's reply.

    In case you need to customize the default menu, you can refer to the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/context-menus/modifying-the-default-context-menu

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top