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

RadGrid GridTemplateColumn Width Issue

5 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahesh Babu
Top achievements
Rank 1
Mahesh Babu asked on 11 Aug 2009, 11:10 AM
Hi,

I want to control the width of my GridTemplateColumns at runtime. When I am assigning to GridTemplateColumn.ItemStyle.Width, it is not working as expected.

Any suggestions please??


Thanks,
Mahesh

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 11 Aug 2009, 01:33 PM
Hello Mahesh,

Try setting the width of the column using the HeaderStyle property of teh column as shown below:
c#:

RadGrid1.MasterTableView.GetColumn("TemplateColumnUniqueName").HeaderStyle.Width = Unit.Pixel(100);

Hope this helps you out..
Shinu.
0
Mahesh Babu
Top achievements
Rank 1
answered on 24 Aug 2009, 08:20 AM
Setting this property is not changing my gridcolumn width. All columns are coming in same widths. Any suggestions please...
0
Princy
Top achievements
Rank 1
answered on 24 Aug 2009, 08:56 AM
Hello Mahesh,

Try setting the TableLayout property of the ownertableview to fixed as shown below and see if it helps:
aspx:
 <telerik:RadGrid DataSourceID="SqlDataSource1" ID="RadGrid1" runat="server">                       
       <MasterTableView TableLayout="Fixed" DataSourceID="SqlDataSource1"

Thanks
Princy.
0
Mahesh Babu
Top achievements
Rank 1
answered on 24 Aug 2009, 10:12 AM
This solved my problem to an extent. Now, the grid is not resizing when I show/hide a column. But still I can still not able to manage each column width. all the columns are of equal width.

Any suggestions please???
0
Dimo
Telerik team
answered on 24 Aug 2009, 02:15 PM
Hello Mahesh,

It will be easier for us to provide some advice if you post your RadGrid declaration here, so that we see what exactly are you trying to do and what's wrong with the setup.

The fact that all columns are the same width means that the TableLayout of the MasterTableView is "Fixed" and no column widths are set.

If you are setting column widths in such a way, that the sum of all widths is smaller than the MasterTableView's width, then all columns will expand.

Greetings,
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
Mahesh Babu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Mahesh Babu
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or