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

[Solved] Change the column width in a GridTableView

5 Answers 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mario
Top achievements
Rank 1
Mario asked on 14 Oct 2009, 07:31 PM
Hello Guys,

How can I change the column width for one column in the Details View of a MasterView

Thanks

5 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Oct 2009, 04:34 AM
Hello Mario,

I suppose you want to change the width of the column in the childtable of a grid dynamically. If so, you can try out the following code:

c#:
RadGrid1.MasterTableView.DetailTables[0].GetColumn("ColumnUniqueName").HeaderStyle.Width = Unit.Pixel(100);

Thanks
Princy.
0
Mario
Top achievements
Rank 1
answered on 15 Oct 2009, 03:50 PM
Thanks Princy,

That was what I was looking for

Just as a comment for anyone else running into this, I placed this code on the

grid_ColumnCreated(), since the columns are autogenerated, the columns are not available until this point, just in case someone try to reference it from the OnInit() or sort of those methods

Regards and thanks again for your support

0
Wendy Hunt
Top achievements
Rank 2
answered on 04 Jan 2010, 08:17 PM
Hi Princy -

What if I wanted to resize a column that is just a row of Select Buttons/Links?
<telerik:GridButtonColumn ButtonType="LinkButton" Text="Select"></telerik:GridButtonColumn> 
These buttons will be directing the user to other pages of data.

Thanks!
wen
0
Princy
Top achievements
Rank 2
answered on 05 Jan 2010, 05:56 AM
Hello Wendy,

You can either set the size for the ButtonColumn declaratively:
aspx:
<telerik:GridButtonColumn ButtonType="LinkButton" UniqueName="ButtonColumn" Text="Select"
   <HeaderStyle Width="100px"/> 
</telerik:GridButtonColumn>  

or set the size dynamically:
c#:
RadGrid1.MasterTableView.GetColumn("ButtonColumn").HeaderStyle.Width = Unit.Pixel(400); 

Thanks
Princy.
0
Wendy Hunt
Top achievements
Rank 2
answered on 05 Jan 2010, 03:30 PM
Thanks Princy!  It worked.

wen
Tags
Grid
Asked by
Mario
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mario
Top achievements
Rank 1
Wendy Hunt
Top achievements
Rank 2
Share this question
or