Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 29th, 2008, 01:59 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 [2005] GridView - empty cell shows no border

I have a GridView that fills one of the cells with plain text from a table. When text is available it fills the cell with the text and a default border for the cell. However, where there is no text in the table, the cell appears empty (which is correct) but with no border at all. It looks a little bit funny. I tried to use the EmptyDataText property for the GridView to set a default text but it does not seem to have any effect. Any ideas??? Thanks.

 
Old July 29th, 2008, 02:12 PM
Friend of Wrox
 
Join Date: Nov 2007
Location: Central Florida, USA.
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default

Set GridLines="Both" if it's not already set.

Jason Hall
 
Old July 29th, 2008, 02:49 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

Jason, GridLines is already set = Both. Any other suggestions? Thank you. Maybe you can detect something in my mark up code:

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" EmptyDataText="N/A">
               <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="80px" Wrap="False" />
                   </asp:BoundField>
                   <asp:BoundField DataField="product_name" HeaderText="Product Name">
                       <ItemStyle HorizontalAlign="Left" Width="80px" Wrap="False" />
                   </asp:BoundField>
                   <asp:BoundField DataField="item_qty" HeaderText="Quantity">
                       <ItemStyle HorizontalAlign="Right" Width="30px" Wrap="False" />
                   </asp:BoundField>
                   <asp:TemplateField HeaderText="Notes">
                       <EditItemTemplate>
                           <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("item_notes") %>'></asp:TextBox>
                       </EditItemTemplate>
                       <ItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text='<%# Bind("item_notes") %>' ToolTip='<%# Bind("item_notes1") %>'></asp:Label>
                       </ItemTemplate>
                       <ItemStyle HorizontalAlign="Left" Width="120px" />
                   </asp:TemplateField>
                   <asp:TemplateField HeaderText="Notes1" Visible="False">
                       <EditItemTemplate>
                           <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("item_notes1") %>'></asp:TextBox>
                       </EditItemTemplate>
                       <ItemTemplate>
                           <asp:Label ID="Label2" runat="server" Text='<%# Bind("item_notes1") %>'></asp:Label>
                       </ItemTemplate>
                   </asp:TemplateField>
            </Columns>
                <HeaderStyle BackColor="#FFC080" Height="35px" />
                <AlternatingRowStyle BackColor="#FFFFC0" /> 
                <RowStyle Height="20px" Wrap="False" />
                <SelectedRowStyle BackColor="#FF8080" Wrap="False" />
            <EmptyDataRowStyle BorderStyle="Solid" />

            </asp:GridView>




Similar Threads
Thread Thread Starter Forum Replies Last Post
cell is empty while using For Each cell In Range jase2007 Excel VBA 4 April 5th, 2012 10:20 PM
Change border color for every cell of a table jdang67 CSS Cascading Style Sheets 10 May 6th, 2010 12:21 AM
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
check if a cell has a bottom border crmpicco Excel VBA 2 January 10th, 2006 07:19 AM
text box to fill cell completely(no white border a Raif ASP.NET 1.0 and 1.1 Professional 0 August 20th, 2004 03:25 PM





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