I have an application with two grids. One is non-daba-bound, the other is a GDBG bound to a DataSet. As the user moves around in the cells of the upper grid, I fetch different data-sets (with different column layouts) and rebind it to the GDBG using the following code:
this.followerGrid.BeginUpdate ( );
this.followerGrid.DataSource = ds;
this.followerGrid.DataMember = ds.Tables[0].TableName;
this.followerGrid.Model.ColWidths.ResizeToFit
(sfGrid.GridRangeInfo.Table(),
sfGrid.GridResizeToFitOptions.IncludeHeaders |
sfGrid.GridResizeToFitOptions.NoShrinkSize );
this.followerGrid.Invalidate ( );
this.followerGrid.EndUpdate ( );
For some reason, when the user shrinks a column width down to nothing, the GDBG seems to "remember" that and when I rebing the GDBG to a new DataSet, it doesn't display all the columns.
I cannot figure out what to reset or clear to cause the GDBG to stop hiding/collapsing the size=zero column(s). I tried...
this.followerGrid.GridBoundColumns.Clear();
... prior to assigning the new dataset, but that didn't have any effect.
Help?
AD
Administrator
Syncfusion Team
August 10, 2003 05:19 PM UTC
After setting the datasource, try
gridDataBoundGrid1.Model.ColWidths.ResetRange(0, this.gridDataBoundGrid1.Model.ColCount);
gridDataBoundGrid1.Model.Cols.Hidden.ResetRange(0, this.gridDataBoundGrid1.Model.ColCount);
gridDataBoundGrid1.Model.ResetVolatileData();
to see if this resets the resized columns and hidden columns.
AD
Administrator
Syncfusion Team
August 10, 2003 11:01 PM UTC
That did the trick, as usual. Thanks again.