No AutoSizeRows for child template?

2 posts, 0 answers
  1. Nancy
    Nancy avatar
    22 posts
    Member since:
    Jun 2005

    Posted 22 Sep 2011 Link to this post

    There is a property for the main masterviewtemplate of a RadGridView to set the rows to auto size if you have a column's WordWrap turned on (i.e., this.radGridViewRequests.AutoSizeRows = true ).  This works slick.
    BUT, for a child template there is no such property to AutoSizeRows if you have a column's WordWrap turned on.  So what is one supposed to do to get the child template rows to resize properly?
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 27 Sep 2011 Link to this post

    Hello Nancy,

    I will post the answer from your support ticket here, so the community can benefit from it:

    The AutoSizeRows property affects all templates in RadGridView. So once you set it to true, you can set the WrapText property of any column in RadGridView and it will size itself accordingly. Alternatively, you can set your own size to rows by handling the CreateRow event. For example, here is how to set the non MasterTemplate cells size:
    void radGridView1_CreateRow(object sender, GridViewCreateRowEventArgs e)
    {
        if (e.RowInfo.ViewTemplate != radGridView1.MasterTemplate)
        {
            e.RowInfo.MinHeight = 40;
            e.RowInfo.MaxHeight = 40;
        }
    }
     
    All the best,
    Stefan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top