Strange behaviour on column width / row height changes

Hi,

When I resize the column widths of my gridgroupingcontrol - if I resize so that the width is 0 or negative, the column simply disappears and i cannot bring it back. I have tried to catch the event TableModel.ColWidthsChanging to avoid widths of 0 or negative, but in this particular scenario, the event is not thrown. It is thrown for widths greater than 0.

The same applies for row heights.

Please can you tell me how I can stop resizing of column widths or row heights to 0.

Thanks.

2 Replies

RA Rajagopal Syncfusion Team June 15, 2007 06:20 PM UTC

Hi Mitul,

You need to catch the gridGroupingControl.TableControlResizingColumns event to avoid the columns getting hidden completely when resizing. Below is the code snippet.

void gridGroupingControl1_TableControlResizingColumns(object sender, GridTableControlResizingColumnsEventArgs e)
{
if (e.Inner.Reason == GridResizeCellsReason.MouseUp && e.Inner.Width == 0)
e.Inner.Cancel = true;
}

Similiarly, for rows you could catch the grid.TableControlResizingRows event handler.

Have a nice time.
Regards,
Rajagopal


HA haneefm Syncfusion Team June 15, 2007 06:24 PM UTC

Hi Mitul,

The Resizing of a column can be prevented by handling the TableControlResizingColumns event and setting the e.Inner.Cancel to true. Also the resizing of a row can be prevented by handling the TableControlResizingRows event and setting the e.Inner.Cancel to true.

private void gridGroupingControl1_TableControlResizingColumns(object sender, GridTableControlResizingColumnsEventArgs e)
{
e.Inner.Cancel = true;
}

Best regards,
Haneef

Loader.
Up arrow icon