Not allow hiding of columns

Dear All,

I tried not to allow the hiding of columns as suggested in http://www.syncfusion.com/support/forums/grid-windows/15563/ColWidthsChanged%20not%20getting%20called but the "e.Cancel=true" setting of the ColsHiding event argument parameter does not work in my application. The columns can be hidden by mouse if their size is moved to 0. Have you any idea, how could I solve this problem? Should I set any other propety too?

Thanks in advance for the answers!
András

1 Reply

RC Rajadurai C Syncfusion Team May 26, 2009 05:45 AM UTC

Hi Andras,

Thanks for your interest in Syncfusion products.

The code handled in ColsHiding event works as expected in our side.

void Model_ColsHiding(object sender, Syncfusion.Windows.Forms.Grid.GridRowColHidingEventArgs e)
{
if (e.From >= 2 && e.To <= 3)
e.Cancel = true;
}

If you still sees the issue, please try the following alternative solution handled in ResizingColumns event to prevent resizing column width to zero at runtime.

//in Form1_Load()
this.gridControl1.ResizingColumns += new GridResizingColumnsEventHandler(gridControl1_ResizingColumns);

//gridControl1_ResizingColumns method
void gridControl1_ResizingColumns(object sender, GridResizingColumnsEventArgs e)
{
if (e.Reason == GridResizeCellsReason.MouseUp)
{
if (e.Width == 0)
{
e.Cancel = true;
}
}
}

This also doesn't allow the column to be resized to width 0.

Regards,
Rajadurai

Loader.
Up arrow icon