How to override default context menu?

4 posts, 0 answers
  1. Satyaprakash
    Satyaprakash avatar
    8 posts
    Member since:
    Jun 2008

    Posted 23 Jun 2008 Link to this post


    I want to add a context menu when i click on the column header of the Windows form RadGridView control. I also want to add another context menu when i click on a row in the RadGridView.

    How could i identify that Colum header is clicked or a row in the RadGridView  is clicked?
  2. Jordan
    Jordan avatar
    547 posts

    Posted 24 Jun 2008 Link to this post

    Hi Satyaprakash,

    Thank you for writing.

    You can easily do that by handling the ContextMenuOpening event of RadGridView as shown below:
    void radGridView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e) 
       if (e.ContextMenuProvider is GridHeaderCellElement) 
        e.ContextMenu = this.columnHeaderMenu; 
       else if (e.ContextMenuProvider is GridDataCellElement) 
        e.ContextMenu = this.rowMenu; 

    I hope this helps. If you have any further questions, please contact me.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Gita
    Gita avatar
    10 posts
    Member since:
    Sep 2011

    Posted 10 Oct 2011 Link to this post

        <ContextMenu IsVisibleChanged="ContextMenu_IsVisibleChanged">
            <MenuItem Header="Export To Excel" Command="Commands:GlobalCommands.ExportGridToExcel" 
                      CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
            <MenuItem Header="Export To Word" Command="Commands:GlobalCommands.ExportGridToWord"
                      CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
    Hello Team,
    We are upgrading the telerik controls to q2 2011 version. In the previous version the Radgridview right click contextmenu was working fine, but not now. What do I have to change in the above code to get the popup menu when I right click the selected row?
    Let me know.

  4. Nikolay
    Nikolay avatar
    1805 posts

    Posted 11 Oct 2011 Link to this post

    Hi Gita,

    Your question seems to be related to our SL/WPF suites. Please note that this forum thread is in the WinForms section. I would kindly ask you to open a new thread in the appropriate forum section. This will allow the appropriate guys to handle your question and also will allow our community to find the answer more easily in case someone else has the same issue.

    Thank you for your understanding.

    Kind regards,

    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Back to Top