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

Column Autowidth

1 Answer 247 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ppti
Top achievements
Rank 1
ppti asked on 15 Dec 2011, 07:39 PM
We need the column width to be automatically adjusted to the content. I managed to make it bigger upon adding text to a cell. However, it dosn't get smaller when the text is deleted from the cell. I use the following code:

<telerikGrid:RadGridView.Columns>
    <telerikGrid:GridViewDataColumn Header="X" Width="Auto" IsReadOnly="True" IsReorderable="False" IsResizable="True" />
    <telerikGrid:GridViewDataColumn  Header="Y" Width="Auto"/>
</telerikGrid:RadGridView.Columns>

Assigning Width="SizeToCells" doesn't do the trick. Am I doing something wrong?

1 Answer, 1 is accepted

Sort by
0
ppti
Top achievements
Rank 1
answered on 16 Dec 2011, 08:04 AM
_RadGrid.Columns[0].Width = new GridViewLength(0, GridViewLengthUnitType.Auto); // fixed
Tags
GridView
Asked by
ppti
Top achievements
Rank 1
Answers by
ppti
Top achievements
Rank 1
Share this question
or