MS work around on text wrapping in a datagrid does not work

Discussion in 'ASP .Net' started by TB, Feb 19, 2006.

  1. TB

    TB Guest

    According to Microsoft (
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;323169 ), there
    is bug in the the datagrid control, causing content to wrap in the
    columns of a datagrid eventhough HeaderStyle Wrap or the ItemStyle Wrap
    property to False.

    Following the advice in the same support article, I have modified my
    datagrid to become the following:

    <asp:datagrid id="MySQLDataGrid" PageSize="6" DataKeyField="ID"
    autogeneratecolumns="False" AlternatingItemStyle-BackColor="#C0C0C0"
    AllowPaging="True" OnPageIndexChanged="PageChange"
    HeaderStyle-BackColor="#88B5DA" Width="100%"
    runat="server">
    <SelectedItemStyle BackColor="Gold"></SelectedItemStyle>
    <EditItemStyle CssClass="MyListitem"></EditItemStyle>
    <AlternatingItemStyle BackColor="Silver"></AlternatingItemStyle>
    <ItemStyle CssClass="myListItem"></ItemStyle>
    <HeaderStyle CssClass="myListItem" BackColor="#88B5DA"></HeaderStyle>
    <Columns>
    <asp:BoundColumn DataField="name" HeaderText="name">
    <HeaderStyle Wrap="False" Width="40px"></HeaderStyle>
    <ItemStyle Wrap="False" Width="40px"></ItemStyle>
    <FooterStyle Wrap="False"></FooterStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="position" HeaderText="position">
    <HeaderStyle Wrap="False" Width="90px"></HeaderStyle>
    <ItemStyle Wrap="False" Width="90px"></ItemStyle>
    <FooterStyle Wrap="False"></FooterStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="note1" HeaderText="note 1Regarding">
    <HeaderStyle Wrap="False" Width="200px"></HeaderStyle>
    <ItemStyle Wrap="False" Width="200px" Height="15px"></ItemStyle>
    <FooterStyle Wrap="False"></FooterStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="note2" HeaderText="note 2">
    <HeaderStyle Wrap="False" Width="200px"></HeaderStyle>
    <ItemStyle Wrap="False" Width="200px"></ItemStyle>
    <FooterStyle Wrap="False"></FooterStyle>
    </asp:BoundColumn>
    </Columns>
    <PagerStyle Font-Size="Small"></PagerStyle>
    </asp:datagrid>

    However, the text still wraps in those columns. What am I missing here?

    Any advice will be highly appreciated.

    Thanks

    TB
    TB, Feb 19, 2006
    #1
    1. Advertising

  2. TB

    TB Guest

    The problem remains. Any suggestions?

    Thanks

    TB
    TB, Feb 22, 2006
    #2
    1. Advertising

  3. TB

    TB Guest

    There doesn't seem to be a lot of interest in this issue. Meanwhile, I
    think I have found the origen of the problem within this line:

    <ItemStyle Wrap="False" Width="200px"></ItemStyle>

    Apparently, the Width parameter is not compatible with the Wrap
    parameter. Without Width, the Wrap=False part is accepted.

    That is a bit of a bother because I would like to be able to have
    non-wrapping text in column with a predefined width.

    Unless somebody in this news group has a better idea, I will stick with

    <ItemStyle Wrap="False"></ItemStyle>

    and the reduce limit the length of my unwrapped text by way of a
    SUBSTRING argument in my SQL statement, thus reducing the column to the
    desired width. Not very elegant but it works.

    TB
    TB, Feb 22, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Kissock

    Wrapping text around Image map problem

    Paul Kissock, Feb 5, 2004, in forum: HTML
    Replies:
    1
    Views:
    459
    Mark Parnell
    Feb 5, 2004
  2. my-wings

    Text wrapping around image

    my-wings, Jun 5, 2004, in forum: HTML
    Replies:
    3
    Views:
    648
    my-wings
    Jun 5, 2004
  3. Marc
    Replies:
    1
    Views:
    478
    Bernhard Sturm
    Jan 18, 2005
  4. JA
    Replies:
    2
    Views:
    601
    Wÿrm
    Jun 12, 2006
  5. Ex-COC
    Replies:
    5
    Views:
    443
    Travis Newbury
    Dec 29, 2007
Loading...

Share This Page