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

T

TB

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
 
T

TB

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top