Grid resize is functioning sometimes and not others
I update the data source to my grid as follows:
In windows designer code:
this.gridDataBoundGrid.DataSource = this.dataViewGrid;
In ReloadGridData() method:
dataViewGrid.Table = gridPortfolioCounterPartyDataSet.PortfolioCounterparties;
gridDataBoundGrid.Model.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders);
This code works fine most of the time. However, during some times when it hits this code, I get a default column width for all columns and the text is wrapped. Why is that?
Also, when I try to resize my columns manually, I get a red drag line and it doesn''t allow it. It goes back to original size and I can only double click the header line to auto size the column. Why is that?
Thanks in advance for any info,
Todd
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
September 13, 2005 10:42 AM UTC
Hi Todd,
Try setting the AllowResizeToFit property to false . This prevents the GridDataBoundGrid from default resizing (getting adjusted according to Column Header Text).
this.gridDataBoundGrid1.AllowResizeToFit=false;
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(0, this.gridDataBoundGrid1.Model.ColCount), GridResizeToFitOptions.IncludeHeaders);
Here is a sample.
autosizecolumn.zip
Let us know if you need further help.
Best Regards,
Jeba.
TA
Todd Armstrong
September 13, 2005 02:07 PM UTC
AllowResizeToFit property is set to false in the Windows Designer code and is never changed. I resize grids all the time in my code and it usually works fine.
It isn''t even resizing to the header size, but smaller, see attached.
It would be great if there were a way to tell the grid to resize by the max of column header or cell data width with properties in the designer instead of having to do this through code.
Any other ideas?
>Hi Todd,
>
>Try setting the AllowResizeToFit property to false . This prevents the GridDataBoundGrid from default resizing (getting adjusted according to Column Header Text).
>
>this.gridDataBoundGrid1.AllowResizeToFit=false;
>this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(0, this.gridDataBoundGrid1.Model.ColCount), GridResizeToFitOptions.IncludeHeaders);
>
>Here is a sample.
>autosizecolumn.zip
>
>Let us know if you need further help.
>
>Best Regards,
>Jeba.
>
grissize_4214.zip
AD
Administrator
Syncfusion Team
September 14, 2005 10:32 AM UTC
Hi Todd,
Currently there is no designer property. You have to call ResizeToFit programmatically at the end of Form load event handler.
Best Regards,
Jeba
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
TA Todd Armstrong
- Sep 13, 2005 12:33 AM UTC
- Sep 14, 2005 10:32 AM UTC