Gridview EmptyDataTemplate Text Wrap

Posted on 2007-08-06
Last Modified: 2013-11-26
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">
                        <asp:TemplateField HeaderText="League" SortExpression="LeagueName">
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("LeagueName") %>'></asp:Label>
                                <asp:LinkButton ID="btnLeague" runat="server" CommandArgument='<%# Eval("LeagueName") %>'
                                    CommandName="League" CssClass="leftlinkswhite" Text='<%# Eval("LeagueName") %>'></asp:LinkButton>
                        <asp:TemplateField HeaderText="Stars Earned" SortExpression="StarsEarned">
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("StarsWon") %>'></asp:TextBox>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("StarsEarned") %>'></asp:Label>
                        <asp:TemplateField HeaderText="Win%" SortExpression="WinPct">
                                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("WinPct") %>'></asp:TextBox>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("WinPct", "{0:P2}") %>' Width="64px"></asp:Label>
                        <asp:BoundField DataField="PicksWon" HeaderText="Won" SortExpression="PicksWon" />
                        <asp:BoundField DataField="PicksLost" HeaderText="Lost" SortExpression="PicksLost" />
                        <asp:TemplateField HeaderText="Buy Picks">
                                &nbsp;<asp:Button ID="btnBuy" runat="server" CausesValidation="False" CommandArgument='<%# Eval("PickerUID") %>'
                                    CommandName="BuyPicks" Text="BUY" />
                    <RowStyle VerticalAlign="Top" />
                    <EditRowStyle Wrap="True" />
                    <HeaderStyle VerticalAlign="Bottom" />
                    <EmptyDataRowStyle Wrap="False" />
Question by:tkargel
    LVL 7

    Accepted Solution

    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.
    LVL 16

    Expert Comment

    Try setting the CssClass attribute of the EmptyDataRowStyle tag and try controlling it with a CSS class.

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now