Wrap one column, makes all columns wrap

4 posts, 0 answers
  1. George
    George avatar
    82 posts
    Member since:
    Apr 2005

    Posted 01 Jul 2009 Link to this post

    I'm running into an issue, and want to know if anyone else is having the issue.

    I have a grid with several columns.  AllowScroll and UseStaticHeaders are both set to true.

    Every apperas to function fine.

    Now, I want to change ONE column so that it's content wraps.

    So I set...
    boundColumn.HeaderStyle.Wrap = true;
    boundColumn.ItemStyle.Wrap = true;
    boundColumn.FooterStyle.Wrap = true;

    Since I am wrapping, I also set a width for the column

    boundColumn.HeaderStyle.Width = Unit.Pixel(100);
    boundColumn.ItemStyle.Width = Unit.Pixel(100);
    boundColumn.FooterStyle.Width = Unit.Pixel(100);

    However, when I do this, it appears that ALL columns begin to wrap, and all columns shrink to fit within the size of the grid.

    Has anyone else run into this?


  2. Terry Webster
    Terry Webster avatar
    48 posts
    Member since:
    Aug 2003

    Posted 01 Jul 2009 Link to this post

    Can you share a little more of the code around the below?

    Are you testing for the column name that is bound before setting the wrap property to true?
  3. George
    George avatar
    82 posts
    Member since:
    Apr 2005

    Posted 02 Jul 2009 Link to this post

    I'm doing more testing.  There could be a number of factors causing this issue...

    1)  I'm using the Grid within a ascx control.
    2)  That control is used in SiteFinity
    3)  I'm using a customized skin based on the RadGrid Hay skin.
    4)  I programmatically generate the columns in Page_Init dependant on what columns the user want to see.

    I'm just going to shelve this question until I get a chance to simplifiy the test standalone and see if I get the same result.

    If you have any suggestions or thoughts, let me know, otherwise, I'm going to do more work on this to determine if it might just be a quirk in one of the pieces described above.

    Thanks anyway, though,

  4. Dimo
    Dimo avatar
    8406 posts

    Posted 06 Jul 2009 Link to this post

    Hi Kuba,

    Actually, text wrapping in RadGrid is enabled by default, so you don't need to enable it specifically. (here is how to disable it if you want to)

    Most probably, the unexpected behavior of the control in your case is caused by the fact that in some circumstances (e.g. enabling features like column resizing, grouping, setting column widths, etc) causes the TableLayout of the RadGrid MasterTableView to be set to "Fixed". In this case the width of the MasterTableView automatically is set to match the width of the RadGrid control and all columns shrink to fit in the available space.

    You can change this behavior by setting widths to all columns or setting some larger width (in pixels) to the MasterTableView.

    Let us know if you need more information.

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top