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

context menu for particular column in radgrid

3 Answers 275 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mohan
Top achievements
Rank 1
Mohan asked on 09 Jul 2012, 06:27 PM
Hi,

           How to make context menu strip for particular column in rad gridview. Please give solution 

3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 12 Jul 2012, 02:05 PM
Hi Mohan,

Thank you for writing.

In the ContextMenuOpening event of RadGridView, you can retrieve the cell the user right-clicked and from it you can get the column the context menu is opened for. In the same event you can customize the items available in the context menu. Here is an example:
private void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
  GridDataCellElement cell = e.ContextMenuProvider as GridDataCellElement;
 
  if (cell == null)
  {
    return;
  }
 
  if (cell.ColumnInfo.Name == "Some column name")
  {
    e.ContextMenu.Items.Add(new RadMenuItem("Column spedific action"));
  }           
}

 I hope this will be useful. Should you have further questions, feel free to write back.
 
Greetings,
Ivan Petrov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Mohan
Top achievements
Rank 1
answered on 12 Jul 2012, 08:10 PM
Hi Ivan,
               Thanks for giving solution. This code working for particular column but after selecting the cell of the column and i right click the mouse any where in the grid context menu is showing. I need solution like context menu is should show with in the particular column of selected cell not in outside  the selected cell and header of the cell. Please immediately give solution for this..
0
Ivan Petrov
Telerik team
answered on 16 Jul 2012, 01:50 PM
Hi Mohan,

Thank you for writing back.

I am afraid I do not fully understand your last reply. Can you please describe in bit greater detail what the current behavior is and what the behavior you want is? Some screen shots or sketches would be very helpful.

I am looking forward to your reply.

Regards,
Ivan Petrov
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
Mohan
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Mohan
Top achievements
Rank 1
Share this question
or