This is a migrated thread and some comments may be shown as answers.

Autofit column width on CellEditEnded

1 Answer 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mahendiran
Top achievements
Rank 1
Mahendiran asked on 26 Jul 2010, 06:45 PM
I need to set column width to resize according to contents on cell edit ended event. I did this but the column doesnt resize most of the times..

e.Cell.Column.Width = GridViewLength.SizeToCells;

Any help in this regard?

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 27 Jul 2010, 06:44 AM
Hello Mahendiran,

Use this code:

void playersGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
    //Set some dummy width in order to trigger property changed
    e.Cell.Column.Width = 100;
    e.Cell.Column.Width = GridViewLength.Auto;
      
}

 

All the best,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Mahendiran
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or