GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem
GridView cell wrapping problem GridView cell wrapping problem
GridView cell wrapping problem
Go Back  Xtreme Visual Basic Talk > > > GridView cell wrapping problem


Reply
 
Thread Tools Display Modes
  #1  
Old 07-23-2008, 01:15 PM
snufse's Avatar
snufse snufse is offline
Centurion
 
Join Date: Jul 2003
Location: West Palm Beach FL
Posts: 180
Default GridView cell wrapping problem


I have a GridView where text in cells wrap in the middle if the cell (not utilizing the complete width of the cell). In the properties of the "BoundFields" definition I have set wrap = false. I also tried this:


Code:
GridView2.DataSource = Nothing
            GridView2.DataSource = MaterialDetailDataTable
            GridView2.DataBind()
            GridView2.Style.Item("wrap") = False
But it still wraps.

So how do I tell the GridView to use full cell width and not to wrap (in code behind)? Thank you.


Code:
<asp:GridView ID="GridView2" runat="server" Style="z-index: 10px; position: relative; top: 43px; border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; font-size: 12px; left: 10px;" Width="518px" AllowPaging="True" AllowSorting="True" Font-Size="Small" AutoGenerateColumns="False" CellSpacing="2" 
            HorizontalAlign="Left" BorderColor="LightGray" BorderStyle="None" PageSize="14" OnSorting="GridView2_Sorting">
               <Columns>
                   <asp:BoundField DataField="job_date" DataFormatString="{0:d}" HeaderText="Date" SortExpression="job_date" HtmlEncode="False">
                       <ItemStyle HorizontalAlign="Center" Width="20px" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_number" HeaderText="Cost Code" HtmlEncode="False">
                       <ItemStyle HorizontalAlign="Left" Width="30px" />
                   </asp:BoundField>
                   <asp:BoundField DataField="source_name" HeaderText="Source Name">
                       <ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
                   </asp:BoundField>
                   <asp:BoundField DataField="product_name" HeaderText="Product Name">
                       <ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_qty" HeaderText="Quantity">
                       <ItemStyle HorizontalAlign="Right" Width="30px" Wrap="False" />
                   </asp:BoundField>
                   <asp:ButtonField CommandName="notes" DataTextField="item_notes" HeaderText="Notes"
                       Text="notes" >
                       <ItemStyle Width="80px" Wrap="False" />
                   </asp:ButtonField>
            </Columns>
                <HeaderStyle BackColor="#FFC080" Height="35px" />
                <AlternatingRowStyle BackColor="#FFFFC0" /> 
                <RowStyle Height="20px" Wrap="False" />
                <SelectedRowStyle BackColor="#FF8080" Wrap="False" />
Reply With Quote
  #2  
Old 08-08-2008, 08:13 PM
HardCode's Avatar
HardCodeGridView cell wrapping problem HardCode is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2004
Location: New Jersey
Posts: 3,339
Default

Well, it looks like you are setting the width of the GridView to 518px. Are you sure that is wide enough to handle the data, so that it doesn't wrap?
__________________
DON'T CLICK HERE

Useful forum tags: [VB][/VB], [CODE][/CODE], [HTML][/HTML]
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem GridView cell wrapping problem
GridView cell wrapping problem
GridView cell wrapping problem
 
GridView cell wrapping problem
GridView cell wrapping problem
 
-->