[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2132
  • Last Modified:

Gridview EmptyDataTemplate Text Wrap

When I load a ASP.NET page containing a gridview, I set the emptydata text of the gridview with a message retrieved from the database. I have a skin for the gridview that specifies "<EmptyDataRowStyle Wrap="False"></EmptyDataRowStyle>". I have also set the EmptyDataRowStyle Font Wrap property to "False". When the page is rendered in IE, the text is wrapped.  What can I do to prevent the wrapping of the EmptyData text?

My html:
                <asp:GridView ID="grdPickerSummary" runat="server" AutoGenerateColumns="False" DataSourceID="datsrcGrid" DataKeyNames="PickerUID" AllowPaging="True" PageSize="3" CssClass="border" AllowSorting="True" SkinID="GridCenter" Height="32px" Width="72px">
                    <Columns>
                        <asp:TemplateField HeaderText="League" SortExpression="LeagueName">
                            <EditItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("LeagueName") %>'></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:LinkButton ID="btnLeague" runat="server" CommandArgument='<%# Eval("LeagueName") %>'
                                    CommandName="League" CssClass="leftlinkswhite" Text='<%# Eval("LeagueName") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Stars Earned" SortExpression="StarsEarned">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("StarsWon") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("StarsEarned") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Win%" SortExpression="WinPct">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("WinPct") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("WinPct", "{0:P2}") %>' Width="64px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="PicksWon" HeaderText="Won" SortExpression="PicksWon" />
                        <asp:BoundField DataField="PicksLost" HeaderText="Lost" SortExpression="PicksLost" />
                        <asp:TemplateField HeaderText="Buy Picks">
                            <ItemTemplate>
                                &nbsp;<asp:Button ID="btnBuy" runat="server" CausesValidation="False" CommandArgument='<%# Eval("PickerUID") %>'
                                    CommandName="BuyPicks" Text="BUY" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <RowStyle VerticalAlign="Top" />
                    <EditRowStyle Wrap="True" />
                    <HeaderStyle VerticalAlign="Bottom" />
                    <EmptyDataRowStyle Wrap="False" />
                </asp:GridView>
0
tkargel
Asked:
tkargel
1 Solution
 
whityumCommented:
your width is only 72px, doesn't give you a lot of room for text, try putting a CSS class or width on the EmptyDataRowStyle with a smaller font or wider width.
0
 
TSmoothCommented:
Try setting the CssClass attribute of the EmptyDataRowStyle tag and try controlling it with a CSS class.
0
 
tkargelAuthor Commented:
I added WIDTH attribute to the skin to no effect.
I added WIDTH attribute to the css class to no effect.
What solved the problem was to REMOVE the WIDTH property setting in the gridview control.
I'll credit you with the solution since the key was your pointing out the 72px width in the html. I asked myself "Where did that get set?". Thanks for the help.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now