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

Proper way to hide or remove row header (Column 0)

I have discovered three different ways to hide the row headers (column 0), but none are entirely satisfactory. I am using a GridControl in virtual mode with Essential Suite Two techniques hide the column, while a third attempts to make the column not a header column. The techniques, and their respective issues, are: 1) Setting the size to 0 in a QueryColumnWidth handler, as in the virtual tree grid example "VirtTreeGrid". The problem with this technique is that clicking on the left side of the leftmost column allows the user to begin a resize of column 0. 2) Setting gridControl.HideCols[0] to true fails when the user hides another column and then double-clicks between the header cells to unhide the unhidden columns. 3) Setting gridControl.Cols.HeaderCount to -1 makes column 0 only partially not a header. Column 0 remains frozen (and a resetFrozen call doesn't unfreeze it), and the arrow keys cannot be used to navigate onto column 0. Any suggestions on how to get rid of column 0 and/or make it act like a normal column?

1 Reply

AD Administrator Syncfusion Team June 16, 2003 04:31 PM UTC

Try these events in conjunction with one another. The ResizingColumns event prevent the sizing cursor from showing.
private void gridControl1_QueryColWidth(object sender, GridRowColSizeEventArgs e)
	if(e.Index == 0)
		e.Size = 0;
		e.Handled = true;

private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
	if(e.Reason == GridResizeCellsReason.HitTest && e.Columns.IntersectsWith(GridRangeInfo.Col(0)))
		e.Cancel = true;

Live Chat Icon For mobile
Up arrow icon