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

RadGrid Column width affecting all columns.

4 Answers 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 06 May 2014, 09:47 PM
When I attempt to change the width of one of my columns, all the columns change. I'v tried Headers, Footers and Items with the same effect.

 Why is this happening?

Any thoughts?

Tom

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 07 May 2014, 04:00 AM
Hi Tom,

You can try the following ways to set the column width. Please note that you have to set only the HeaderStyle width property and not ItemStyle's.

In ASPX:
<telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" Aggregate="Count">
  <HeaderStyle Width="500px"  />  
</telerik:GridBoundColumn>

From C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
  RadGrid1.MasterTableView.GetColumn("ShipCity").HeaderStyle.Width = Unit.Pixel(500);
}

Using CSS:
<style type="text/css">
    .setWidth
    {
        width: 500px;
    }
</style>

ASPX:
<telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" Aggregate="Count"
    <HeaderStyle CssClass="setWidth" />
</telerik:GridBoundColumn>

If this doesn't help, please provide your code snippet.

Thanks,
Princy
0
Tom
Top achievements
Rank 1
answered on 07 May 2014, 01:17 PM
Thanks Princy; I'm very new to Telerik but have many years of sql and C#. I see that there are many configuration wizards. I will be a big user of the grid. Is there any way to create a template from an existing RadGrid that I have built successfully? Any help would be greatly appreciated.

Thanks again
Tom 
0
Princy
Top achievements
Rank 1
answered on 08 May 2014, 09:39 AM
Hi Tom,

I'm not clear about your requirement. Can you please elaborate on what you want to acquire so as to help you.

Thanks,
Princy
0
Tom
Top achievements
Rank 1
answered on 08 May 2014, 01:10 PM
Thanks, I got it fixed. I think my setup was wrong. All is working
ok now.

Thanks again.

Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Tom
Top achievements
Rank 1
Share this question
or