AD
Administrator
Syncfusion Team
August 11, 2005 08:27 AM UTC
I think your code is the way to do this. But if you want to do this when the grid is not visible (like in Form.Load), then you also have to set:
this.gridDataBoundGrid1.AllowResizeToFit = false;
But turning AllowResizeToFit to false, will prevent the other columns to be sized to fit by default. If you want this to happen, then you would also add a call to ResizeToFit.
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(1, this.gridDataBoundGrid1.Model.ColCount), GridResizeToFitOptions.IncludeHeaders);
Here is a little sample showing this working.
http://www.syncfusion.com/Support/user/uploads/GDBG_SizeRowHeader_460c5d41.zip
AD
Administrator
Syncfusion Team
August 12, 2005 02:45 AM UTC
Thanks for your prompt reply Clay however your suggestion only seems to work when the GridDataBoundGrid control is placed on the form in the designer.
I still get the same strange behaviour when instantiating and placing the control on the page entirely through code.
Any other ideas?
AD
Administrator
Syncfusion Team
August 12, 2005 07:16 AM UTC
I think the same sort of code should work at runtime. Here is the sample with the grid being created and displayed in a button handler.
http://www.syncfusion.com/Support/user/uploads/GDBG_SizeRowHeader_4591632b.zip
Can you modify this sample to show the problem you are having?