Changing the length of cell holding column names in DBDG

Hi all,

I''m using DBDG.
when I load a table, the column names get spanned on two lines as the space is not sufficient to show the column name in one line.
Can some one tell how to dynamically change the width of column to match with the length of the text held by that cell.

Thanks in advance
Suhas

1 Reply

AD Administrator Syncfusion Team August 10, 2006 09:33 AM UTC

Hi Suhas,

Please set the AllowResizeToFit property of the databoundgrid to true in the form_Load, this will help you to display the entire name in single line. This property is true by default.

this.gridDataBoundGrid1.AllowResizeToFit = true;

You can call the ResizeToFit method to dynamically make the contents of the cell to fit inside.
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit( GridRangeInfo.Col(2) ); // resizes column 2

FYI, you can also set the column widths manually for any particular column,like in the code below,
this.gridDataBoundGrid1.Model.ColWidths[2] = 75; // setting the column width for column2

Regards,
Rajagopal

Loader.
Up arrow icon