I'm wondering how to set a column width when my grid is empty.
Right now I'm using the <columns> to generate my template, and NoRecordsTemplate which just says 'No Rows'.
Inside Columns I have several GridTemplateColumn fields and use ItemStyle to set the width.
The problem is when the grid is empty the column widths do not apply.
I have pasted in the code for the grid below:
<telerik:RadGrid ID="rdGrdDueToday" Height="200px" runat="server" Width="100%" AutoGenerateColumns="False"
Skin="Sunset" AllowCustomPaging="false" DataSourceID="dsBFsDueToday" AllowSorting="true"
OnItemCommand="rdGrdGeneric_itemcommand" AllowPaging="false" DataKeyNames="brfo_id"
OnDataBound="rdGrdGeneric_Databound">
<MasterTableView DataSourceID="dsBFsDueToday" DataKeyNames="brfo_id">
<AlternatingItemStyle CssClass="evenRowBFs" />
<NoRecordsTemplate>
No BFs were found</NoRecordsTemplate>
<HeaderStyle CssClass="HeaderBFs" />
<ItemStyle CssClass="oddRowBFs" />
<Columns>
<telerik:GridTemplateColumn HeaderText="PID" DataType="System.Int32" UniqueName="prsn_id"
SortExpression="prsn_id">
<ItemStyle HorizontalAlign="Left" Width="68px" VerticalAlign="Middle" />
<ItemTemplate>
<asp:Label runat="server" ID="lblPID" Text='<%# Eval("prsn_id") %>' CssClass="labelOneRowHighFontBigger"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Name" DataType="System.String" UniqueName="Name"
SortExpression="Name">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Height="15px" Width="275px" />
<ItemTemplate>
<asp:Label runat="server" ID="lblName" Text='<%# Eval("Name") %>' CssClass="labelOneRowHighFontBigger"> </asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="True" EnableRowHoverStyle="True">
<Scrolling AllowScroll="True"></Scrolling>
</ClientSettings>
</telerik:RadGrid>
Right now I'm using the <columns> to generate my template, and NoRecordsTemplate which just says 'No Rows'.
Inside Columns I have several GridTemplateColumn fields and use ItemStyle to set the width.
The problem is when the grid is empty the column widths do not apply.
I have pasted in the code for the grid below:
<telerik:RadGrid ID="rdGrdDueToday" Height="200px" runat="server" Width="100%" AutoGenerateColumns="False"
Skin="Sunset" AllowCustomPaging="false" DataSourceID="dsBFsDueToday" AllowSorting="true"
OnItemCommand="rdGrdGeneric_itemcommand" AllowPaging="false" DataKeyNames="brfo_id"
OnDataBound="rdGrdGeneric_Databound">
<MasterTableView DataSourceID="dsBFsDueToday" DataKeyNames="brfo_id">
<AlternatingItemStyle CssClass="evenRowBFs" />
<NoRecordsTemplate>
No BFs were found</NoRecordsTemplate>
<HeaderStyle CssClass="HeaderBFs" />
<ItemStyle CssClass="oddRowBFs" />
<Columns>
<telerik:GridTemplateColumn HeaderText="PID" DataType="System.Int32" UniqueName="prsn_id"
SortExpression="prsn_id">
<ItemStyle HorizontalAlign="Left" Width="68px" VerticalAlign="Middle" />
<ItemTemplate>
<asp:Label runat="server" ID="lblPID" Text='<%# Eval("prsn_id") %>' CssClass="labelOneRowHighFontBigger"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Name" DataType="System.String" UniqueName="Name"
SortExpression="Name">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Height="15px" Width="275px" />
<ItemTemplate>
<asp:Label runat="server" ID="lblName" Text='<%# Eval("Name") %>' CssClass="labelOneRowHighFontBigger"> </asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="True" EnableRowHoverStyle="True">
<Scrolling AllowScroll="True"></Scrolling>
</ClientSettings>
</telerik:RadGrid>