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

Prevent unhiding of columns

I have a grid that I provide QueryCellInfo, QueryColCount and QueryRowCount event handlers to populate with. I also programmitically configure columns at runtime like so: gridControl1.ColStyles[1].ReadOnly = true; gridControl1.Cols.Hidden[1] = true; gridControl1.ColStyles[2].ReadOnly = true; gridControl1.Cols.Hidden[2] = true; gridControl1.ColStyles[3].ReadOnly = true; gridControl1.ColWidths[3] = 100; gridControl1[0,3].Text = "Instrument"; I need to ensure that columns that I specify as being hidden, stay hidden. I don''t want to allow the user to unhide columns (or hide them for that matter). Thank you, Mike

4 Replies

MP Michael Prince April 4, 2005 02:24 PM

I solved my problem by setting the grid''s AllowSelectoin value = Cell only. >I have a grid that I provide QueryCellInfo, QueryColCount and QueryRowCount event handlers to populate with. I also programmitically configure columns at runtime like so: > >gridControl1.ColStyles[1].ReadOnly = true; >gridControl1.Cols.Hidden[1] = true; >gridControl1.ColStyles[2].ReadOnly = true; >gridControl1.Cols.Hidden[2] = true; >gridControl1.ColStyles[3].ReadOnly = true; >gridControl1.ColWidths[3] = 100; >gridControl1[0,3].Text = "Instrument"; > >I need to ensure that columns that I specify as being hidden, stay hidden. I don''t want to allow the user to unhide columns (or hide them for that matter). > >Thank you, >Mike


MP Michael Prince April 4, 2005 02:32 PM

This did not solve my problem. I still need to be able to prevent the "unhiding" of columns. Thanks >I solved my problem by setting the grid''s AllowSelectoin value = Cell only. > >>I have a grid that I provide QueryCellInfo, QueryColCount and QueryRowCount event handlers to populate with. I also programmitically configure columns at runtime like so: >> >>gridControl1.ColStyles[1].ReadOnly = true; >>gridControl1.Cols.Hidden[1] = true; >>gridControl1.ColStyles[2].ReadOnly = true; >>gridControl1.Cols.Hidden[2] = true; >>gridControl1.ColStyles[3].ReadOnly = true; >>gridControl1.ColWidths[3] = 100; >>gridControl1[0,3].Text = "Instrument"; >> >>I need to ensure that columns that I specify as being hidden, stay hidden. I don''t want to allow the user to unhide columns (or hide them for that matter). >> >>Thank you, >>Mike


AD Administrator Syncfusion Team April 4, 2005 03:26 PM

If you do not want your suer to double click and un hide a column, then try handling ResizingColumns.
private void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
	if(e.Reason == GridResizeCellsReason.DoubleClick || e.Reason == GridResizeCellsReason.ResetHide)
		e.Cancel = true;
}


MP Michael Prince April 5, 2005 10:00 AM

Thanks Clay, that did the trick.

Loader.
Live Chat Icon For mobile
Up arrow icon