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

GridView column resize

3 Answers 158 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 27 May 2008, 02:54 AM
Hello.  I am evaluating the GridView product and had a few quick questions...

Is there was a way to have the columns automatically sized to fit it contents?  It seems that the only choice is "Fill" which doesn't give me what I am after.  I guess I am looking for functionality that is similar to the Microsoft DataGridView "AutoSizeColumnsMode" property that can be set to:

None
ColumnHeader
AllCellsExceptHeader
AllCells
DisplayedCellsExceptHeader
DisplayedCells
Fill

Also, when I change the "BackColor" for the grid, it does not seem to have an effect.  Am I missing something?

Thanks,
David

3 Answers, 1 is accepted

Sort by
0
Kiril
Telerik team
answered on 27 May 2008, 08:08 AM
Hello David,

Thank you for writing.

Currently, the RadGridView features the AutoSizeColumnsMode property of the ViewTemplate. It has only two possible values:

  • None - the columns are initialized with the same width, and do not necessarily fill the width of the control. Resizing a column does not impact the width of the other columns.
  • Fill - the columns are stretched to fill the entire width of the control. Resizing any column impacts the width of other columns, as the total width is always equal to the width of the control.
At this time, the rest of the modes you mentioned are not supported. Still, we do support the BestFit function, which sets the width of a column to as to fit all currently visible values in it. You can invoke it on any column object (after binding, or adding columns manually) as shown below:

this.radGridView1.Columns[0].BestFit(); 

The column best-fit modes you have enumerated are on our TODO list. However, we cannot give any definite timeframe when this functionality will be available.

I hope this helps. If you have any additional questions, please let me know.

Greetings,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 28 May 2008, 04:33 PM
Thanks, I appreciate your response.

I really do believe that these other modes would go a long, long way towards the refinement of the grid.  They would add a ton of value to the look of the grid, which I have to believe is a big part of your sales pitch.

Regards,
David
0
Jack
Telerik team
answered on 29 May 2008, 08:13 AM
Hello David,

Thank you for these suggestions.

You are correct. The different column sizing modes are a powerful feature and we plan to implement it in one of our upcoming versions.

Do not hesitate to contact me, if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
David
Top achievements
Rank 1
Answers by
Kiril
Telerik team
David
Top achievements
Rank 1
Jack
Telerik team
Share this question
or