Adjust the cell''s width to fix the cell value

hi,

i using the GridControl, how to i adjust the cell''s width to fix the cell value dynamcally?

2 Replies

AD Administrator Syncfusion Team September 20, 2006 05:14 AM UTC

Hi Lim,

To resize the width of the column to fit the size of the text, you need to call the ResizeToFit method . Below is a code snippet.

//Resize the ColIndex depends on the cell( RowIndex , ColIndex);
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Cell( RowIndex , ColIndex));

//Resize the both LeftColIndex and RightColIndex depend on the cells( TopRowIndex , LeftColIndex,,BottomRowIndex, RightColIndex);
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Cells( TopRowIndex , LeftColIndex,,BottomRowIndex, RightColIndex));

//Resize the ColIndex depends on the all cell in the same column
grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Col( ColIndex));

Let me know if you are looking something different.

Best Regards,
Haneef


AD Administrator Syncfusion Team September 20, 2006 09:48 AM UTC

hi,

i am here to make my problem clearer..

my gridControl has a coveredRange of two column as below..

|___________| <-- Header one(Covered Range)
|_____|_____| <--- Header two

how to set the column 2 to resize to fit the cell value?

grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Col(2)); is not working in my grid..

please help

Loader.
Up arrow icon