Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 21st, 2008, 04:53 PM
Friend of Wrox
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default GridView - cell wrapping - need help

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:

GridView2.DataSource = Nothing
            GridView2.DataSource = MaterialDetailDataTable
            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.

<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">
                   <asp:BoundField DataField="job_date" DataFormatString="{0:d}" HeaderText="Date" SortExpression="job_date" HtmlEncode="False">
                       <ItemStyle HorizontalAlign="Center" Width="20px" />
                   <asp:BoundField DataField="item_number" HeaderText="Cost Code" HtmlEncode="False">
                       <ItemStyle HorizontalAlign="Left" Width="30px" />
                   <asp:BoundField DataField="source_name" HeaderText="Source Name">
                       <ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
                   <asp:BoundField DataField="product_name" HeaderText="Product Name">
                       <ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
                   <asp:BoundField DataField="item_qty" HeaderText="Quantity">
                       <ItemStyle HorizontalAlign="Right" Width="30px" Wrap="False" />
                   <asp:ButtonField CommandName="notes" DataTextField="item_notes" HeaderText="Notes"
                       Text="notes" >
                       <ItemStyle Width="80px" Wrap="False" />
                <HeaderStyle BackColor="#FFC080" Height="35px" />
                <AlternatingRowStyle BackColor="#FFFFC0" /> 
                <RowStyle Height="20px" Wrap="False" />
                <SelectedRowStyle BackColor="#FF8080" Wrap="False" />
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Change value in GridView Cell Sheraz Khan ASP.NET 2.0 Professional 2 August 30th, 2007 11:12 AM
Problem in Gridview Cell Lalit Pradhan ASP.NET 2.0 Professional 2 August 1st, 2007 04:08 AM
How to change the value of one cell in a GridView? jameslin288@yahoo.com ASP.NET 2.0 Basics 8 November 19th, 2006 01:12 PM

All times are GMT -4. The time now is 09:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.