We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Identify a column on right clicking on the column's header

Hi.

I have a GridGroupingControl. I would like to do a custom action with the column, say a custom "hide column".

There is a way to identify the column name when right clicking (I display a context menu by the way) on the column's header or cell?

I have a ContextMenuStrip_Opening, but it does not bring any info about the column.
I have also myGrid_TableControlCellClick but this one action only on the cell and only on the left click...

1 Reply

AG Anish George Syncfusion Team January 29, 2014 05:25 AM UTC

Hi Serhio,

 

Thank you for using Syncfusion products.

 

We would like to let you know that we can get the current column index while right clicking by using the following code snippet.

 

C#:

this.gridGroupingControl1.TableControlMouseDown += new GridTableControlMouseEventHandler(gridGroupingControl1_TableControlMouseDown);

void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)

{

if (e.Inner.Button == System.Windows.Forms.MouseButtons.Right)

{

GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

this.gridGroupingControl1.TableDescriptor.VisibleColumns.RemoveAt(cc.ColIndex);

}

}

 

Please let us know if you need any further assistance.

 

Regards,

Anish


Loader.
Live Chat Icon For mobile
Up arrow icon