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

RadGrid ignores ItemStyle-Width settings when there are "no records to display"

2 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 31 Mar 2015, 03:07 PM
The Grid has four columns (50%,15%,20%,15%) which are correct in width if there is data returned to fill the grid.  
If there is no data and the grid displays "No records to display" message the column width no longer is the same.  
How can I force the correct width of the columns regardless of getting records back or not?


<telerik:RadGrid ID="rgOptional" runat="server" AllowSorting="True" 
AutoGenerateColumns="False" DataSourceID="pdsOptional" Width="100%">
<MasterTableView OverrideDataSourceControlSorting="true" AllowSorting="true" DataKeyNames="EducationId" >
<Columns >
<telerik:GridTemplateColumn HeaderText='Optional Education Offerings' ItemStyle-Width="50%" >
<ItemTemplate>
<asp:LinkButton CommandName='SelectEducation' Runat='server' ID="lb_selectEducation1" ><%#DataBinder.Eval(Container.DataItem, "Name") %> </asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>                            
<telerik:GridBoundColumn DataField="Status" HeaderText="Status" HtmlEncode="False" SortExpression="Status" ItemStyle-Width="15%" />
<telerik:GridBoundColumn DataField="CompletionDate" DataFormatString="{0:g}" HeaderText="Completion Date" HtmlEncode="False" SortExpression="CompletionDate" ItemStyle-Width="20%" />
<telerik:GridBoundColumn DataField="PC" HeaderText="PC" SortExpression="PC" ItemStyle-Width="15%" />
</Columns>
</MasterTableView>
</telerik:RadGrid> 

<FHS:PageDataSource ID="pdsOptional" runat="server" SelectMethod="GetAllOptionalEducationOfferings" />
            








2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 31 Mar 2015, 03:44 PM
Hi,

For setting columns width you should use HeaderStyle-Width property instead of ItemStyle-Width.

Regards,
Pavlina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Patrick
Top achievements
Rank 1
answered on 31 Mar 2015, 06:31 PM
That worked! Thank you!
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or