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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get column index on click of column header

Thread ID:





58289 Mar 21,2007 05:24 PM UTC Mar 21,2007 05:52 PM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On March 21, 2007 05:24 PM UTC


Which event will give me the column index of the column when mouse button is clicked on column header.


Administrator [Syncfusion]
Replied On March 21, 2007 05:52 PM UTC


You can handle the MouseDown event of the grid and call the PointToRowCol method to detect the RowIndex and ColIndex of the cell in a Grid. Here is a code snipet

void gridDataBoundGrid1_MouseDown(object sender, MouseEventArgs e)
int row, col;
GridDataBoundGrid grid = sender as GridDataBoundGrid;
if (grid.PointToRowCol(new Point(e.X,e.Y), out row, out col))
if (grid.Model[row,col].CellType == "ColumnHeaderCell")
MessageBox.Show(string.Format( "Column Header Index is {0}", col));

Best regards,


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon