Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TB - 19 Feb 2006 18:07 GMT
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 - 22 Feb 2006 09:32 GMT
The problem remains. Any suggestions?

Thanks

TB
TB - 22 Feb 2006 22:34 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.