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

ColumnHeader Double Click

Hi, I want to capture what column header was double clicked. I''m using the TableControlCellDoubleClick event, which has the GridTableControlCellClickEventArgs. The options i get are Inner and TableControl. The thing is when i chose inner, it gives me the wrong column index and if i chose tablecontrol.currentcell i get -1 for rowindex and colindex, because nothing''s selected obviously. How do i get the column index of the column header the users'' clicked on? i also need to check if it''s the column header that''s been clicked (rowindex = 0). thanks in advanced!

1 Reply

AD Administrator Syncfusion Team December 8, 2004 07:20 AM UTC

For me, I could not get TableControlCellDoubleClick to be raised on header cells. I might have differernt properties set than you do. But I was able to use TableControlMouseDown and look for 2 leftclicks. In that event, you can test for a header row and get teh column clicked using code like:
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
	if(e.Inner.Clicks == 2 && e.Inner.Button == MouseButtons.Left)
		int row, col;
		Point pt = new Point(e.Inner.X, e.Inner.Y);
		if(e.TableControl.PointToRowCol(pt, out row, out col))
			GridColumnHeaderRow headerRow = e.TableControl.Table.DisplayElements[row] as GridColumnHeaderRow;
			if(headerRow != null)
				int pos = e.TableControl.TableDescriptor.ColIndexToField(col);
				string colName = e.TableControl.TableDescriptor.VisibleColumns[pos].Name;

Live Chat Icon For mobile
Up arrow icon