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

Resize grid columns based on content?

1 Answer 286 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian Roth
Top achievements
Rank 1
Brian Roth asked on 13 Feb 2015, 10:34 PM
Hello,

I'm trying to build up a table-based report where I'm trying to keep the layout as tight as possible width-wise.  I'd like to be able to programmatically set the widths of my columns based on the width of the largest value in the data set so that the columns would be at the minimum width required to not wrap any of the content.  I was looking through the object model for the column and cell objects and couldn't figure out if there was a property that would get me the actual content size.  Do you know if there's a way to accomplish this?  Thanks so much for your help!

Regards,
Brian

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 17 Feb 2015, 12:07 PM
Hello Brian,

There is no property for the actual content size. The content size is based on the field value, the used font family, font size, etc., so it would not be trivial matter to programmatically re-size a column to fit the longest value. You can find more information and ideas on the topic in the Auto size for textbox thread.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Brian Roth
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or