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

Wrap one column, makes all columns wrap

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 01 Jul 2009, 07:54 PM
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?

Thanks,
Kuba

3 Answers, 1 is accepted

Sort by
0
Terry Webster
Top achievements
Rank 2
answered on 02 Jul 2009, 04:54 AM
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?
0
George
Top achievements
Rank 1
answered on 02 Jul 2009, 03:51 PM
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,

Kuba
0
Dimo
Telerik team
answered on 06 Jul 2009, 08:46 AM
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,
Dimo
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.
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Terry Webster
Top achievements
Rank 2
George
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or