Resize grid columns based on content?

2 posts, 0 answers
  1. Brian Roth
    Brian Roth avatar
    139 posts
    Member since:
    Oct 2005

    Posted 13 Feb 2015 Link to this post

    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
  2. Nasko
    Admin
    Nasko avatar
    1051 posts

    Posted 17 Feb 2015 Link to this post

    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.

     
Back to Top