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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

115622 Jan 27,2014 07:22 AM Jan 29,2014 12:25 AM Windows Forms 1
loading
Tags: Grouping
serhio
Asked On January 27, 2014 07:22 AM

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...

Anish George [Syncfusion]
Replied On January 29, 2014 12:25 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;