473,378 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

disapearing gridlines in gridview

Hello Everyone,

I have a gridview. I am using template columns inside the gridview.
When I display the gridview on the web page and if there is no value in a
particular cell, gridline disappaers around that cell.I want the grid lines
to appear all the time even if the cell is empty. Can anyone tell me what am
I doing wrong. Below is my gridview. I am showing only one template column. I
have around 14 template column in the gridview.
<asp:GridView ID="dgAgentActivity" runat="server"
AutoGenerateColumns="false" CellPadding="0" CellSpacing="1"
BackColor="AliceBlue" OnRowCreated="dgAgentActivity_RowCreated"
ShowFooter="true" >
<Columns>

<asp:templatefield headertext="SwitchTime" >

<itemtemplate>
<%#Eval("SwitchTime")%>
</itemtemplate>
<footertemplate>
<asp:label id="SwitchTime" runat="server"/>
</footertemplate>
</asp:templatefield>
<columns>

Thanks.

Apr 26 '07 #1
4 6614
That's how the browser renders a <tdthat has no content. Often, an nbsp;
is put in such a TD to get it to render the way you want it. So, depending
on how you get your data or how you want to do it, you may want to consider
replacing empty values with &nbsp;.

Notice what happens if you add this:
<style type="text/css">
table.Vinki td { height: 3em; border: 1px solid #000000; }
</style>

And give your GridView a CssClass="Vinki" property. Load this in IE and
then in Firefox. It's all in how each browser decides to deal with things,
and it's a pita!

Ray at work

"Vinki" <Vi***@discussions.microsoft.comwrote in message
news:AF**********************************@microsof t.com...
Hello Everyone,

I have a gridview. I am using template columns inside the gridview.
When I display the gridview on the web page and if there is no value in a
particular cell, gridline disappaers around that cell.I want the grid
lines
to appear all the time even if the cell is empty. Can anyone tell me what
am
I doing wrong. Below is my gridview. I am showing only one template
column. I
have around 14 template column in the gridview.
<asp:GridView ID="dgAgentActivity" runat="server"
AutoGenerateColumns="false" CellPadding="0" CellSpacing="1"
BackColor="AliceBlue" OnRowCreated="dgAgentActivity_RowCreated"
ShowFooter="true" >
<Columns>

<asp:templatefield headertext="SwitchTime" >

<itemtemplate>
<%#Eval("SwitchTime")%>
</itemtemplate>
<footertemplate>
<asp:label id="SwitchTime" runat="server"/>
</footertemplate>
</asp:templatefield>
<columns>

Thanks.
Apr 26 '07 #2
Hi Ray,

Thanks for replying. Do you know any way or if you have any example, I can
replace the empty cells with in gridview.

Thanks.

"Ray Costanzo" wrote:
That's how the browser renders a <tdthat has no content. Often, an nbsp;
is put in such a TD to get it to render the way you want it. So, depending
on how you get your data or how you want to do it, you may want to consider
replacing empty values with .

Notice what happens if you add this:
<style type="text/css">
table.Vinki td { height: 3em; border: 1px solid #000000; }
</style>

And give your GridView a CssClass="Vinki" property. Load this in IE and
then in Firefox. It's all in how each browser decides to deal with things,
and it's a pita!

Ray at work

"Vinki" <Vi***@discussions.microsoft.comwrote in message
news:AF**********************************@microsof t.com...
Hello Everyone,

I have a gridview. I am using template columns inside the gridview.
When I display the gridview on the web page and if there is no value in a
particular cell, gridline disappaers around that cell.I want the grid
lines
to appear all the time even if the cell is empty. Can anyone tell me what
am
I doing wrong. Below is my gridview. I am showing only one template
column. I
have around 14 template column in the gridview.
<asp:GridView ID="dgAgentActivity" runat="server"
AutoGenerateColumns="false" CellPadding="0" CellSpacing="1"
BackColor="AliceBlue" OnRowCreated="dgAgentActivity_RowCreated"
ShowFooter="true" >
<Columns>

<asp:templatefield headertext="SwitchTime" >

<itemtemplate>
<%#Eval("SwitchTime")%>
</itemtemplate>
<footertemplate>
<asp:label id="SwitchTime" runat="server"/>
</footertemplate>
</asp:templatefield>
<columns>

Thanks.
Apr 26 '07 #3
Hi Ray,

I tried doing this

for (int i = 0; i <= 17; i++)
{
if
(((DataBoundLiteralControl)e.Row.Cells[2].Controls[0]).Text.Trim() ==
string.Empty)

((DataBoundLiteralControl)e.Row.Cells[2].Controls[0]).Text = "&nbsp";

}

but this didn't work. I have 18 template columns so I want to do it in a
loop. Is there any other way I can do it.

"Ray Costanzo" wrote:
That's how the browser renders a <tdthat has no content. Often, an nbsp;
is put in such a TD to get it to render the way you want it. So, depending
on how you get your data or how you want to do it, you may want to consider
replacing empty values with .

Notice what happens if you add this:
<style type="text/css">
table.Vinki td { height: 3em; border: 1px solid #000000; }
</style>

And give your GridView a CssClass="Vinki" property. Load this in IE and
then in Firefox. It's all in how each browser decides to deal with things,
and it's a pita!

Ray at work

"Vinki" <Vi***@discussions.microsoft.comwrote in message
news:AF**********************************@microsof t.com...
Hello Everyone,

I have a gridview. I am using template columns inside the gridview.
When I display the gridview on the web page and if there is no value in a
particular cell, gridline disappaers around that cell.I want the grid
lines
to appear all the time even if the cell is empty. Can anyone tell me what
am
I doing wrong. Below is my gridview. I am showing only one template
column. I
have around 14 template column in the gridview.
<asp:GridView ID="dgAgentActivity" runat="server"
AutoGenerateColumns="false" CellPadding="0" CellSpacing="1"
BackColor="AliceBlue" OnRowCreated="dgAgentActivity_RowCreated"
ShowFooter="true" >
<Columns>

<asp:templatefield headertext="SwitchTime" >

<itemtemplate>
<%#Eval("SwitchTime")%>
</itemtemplate>
<footertemplate>
<asp:label id="SwitchTime" runat="server"/>
</footertemplate>
</asp:templatefield>
<columns>

Thanks.
Apr 26 '07 #4
Yeah, I'd say your best bet is to go for a solution that does not involve
modifying your data.

There is a CSS attribute for the table element called empty-cells, but as is
typical, IE doesn't support it. But, if you set border-collapse to collapse
at the table level, IE will show the border on the empty cells. Hopefully
this will fit with the look you're going for.

<style type="text/css">
table.test { border-collapse: collapse; }
table.test td { border: 1px solid #000000; empty-cells: show; width: 33%}
</style>
<table class="test">
<tr>
<td>content</td>
<td></td>
<td>content</td>
</tr>
</table>

Ray at work
"Vinki" <Vi***@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
Hi Ray,

I tried doing this

for (int i = 0; i <= 17; i++)
{
if
(((DataBoundLiteralControl)e.Row.Cells[2].Controls[0]).Text.Trim() ==
string.Empty)

((DataBoundLiteralControl)e.Row.Cells[2].Controls[0]).Text = "&nbsp";

}

but this didn't work. I have 18 template columns so I want to do it in a
loop. Is there any other way I can do it.

"Ray Costanzo" wrote:
>That's how the browser renders a <tdthat has no content. Often, an
nbsp;
is put in such a TD to get it to render the way you want it. So,
depending
on how you get your data or how you want to do it, you may want to
consider
replacing empty values with .

Notice what happens if you add this:
<style type="text/css">
table.Vinki td { height: 3em; border: 1px solid #000000; }
</style>

And give your GridView a CssClass="Vinki" property. Load this in IE and
then in Firefox. It's all in how each browser decides to deal with
things,
and it's a pita!

Ray at work

"Vinki" <Vi***@discussions.microsoft.comwrote in message
news:AF**********************************@microso ft.com...
Hello Everyone,

I have a gridview. I am using template columns inside the gridview.
When I display the gridview on the web page and if there is no value in
a
particular cell, gridline disappaers around that cell.I want the grid
lines
to appear all the time even if the cell is empty. Can anyone tell me
what
am
I doing wrong. Below is my gridview. I am showing only one template
column. I
have around 14 template column in the gridview.
<asp:GridView ID="dgAgentActivity" runat="server"
AutoGenerateColumns="false" CellPadding="0" CellSpacing="1"
BackColor="AliceBlue" OnRowCreated="dgAgentActivity_RowCreated"
ShowFooter="true" >
<Columns>

<asp:templatefield headertext="SwitchTime" >

<itemtemplate>
<%#Eval("SwitchTime")%>
</itemtemplate>
<footertemplate>
<asp:label id="SwitchTime" runat="server"/>
</footertemplate>
</asp:templatefield>
<columns>

Thanks.
Apr 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matt | last post by:
I can not get the horizontal gridlines to show up on a Gridview. I have changed the selection to both and horizontal with no sign of them. Also, when I set the Gridlines property to Vertical or...
2
by: Mike P | last post by:
I set Gridlines="None" and I still get gridlines in my GridView. Is there anything else that you need to do to totally remove gridlines? *** Sent via Developersdex...
0
by: damnBoi | last post by:
Good day guys! I'm using c# as my code-behind (ascx.cs) and my environment is Visual Studio 2008. the issue is, i can't get to access labels inside the gridview.. my gridview definition is:...
7
by: =?Utf-8?B?U0FM?= | last post by:
I am trying to cast my Gridview in my Code behide as a Dataset so I can manipulate the data. Here is the code snippet: Dim FilteredDataSet As New System.Data.DataSet Dim gv As New GridView gv...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I am using a CssClass to fix the gridview header in ASP.Net 2005(C#),which is working fine in IE..But not working in Firefox..This is the cssclass which I'm using right now ...
3
by: ulai | last post by:
Thanks for your help. It really help to solve my work. But now i have a bigger problem : I had more than 65535 records in gridview divide by 10/pages. And when i tried to export the gridview in...
2
by: xMetalDetectorx | last post by:
Hi Everyone, I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a...
8
by: hiranmaie | last post by:
Hi, I am having 3 textboxes and 1 gridview. I want to pass (reflect) the values from textboxes to gridview. I am not using the database here. I want to save the data directly from textboxes...
2
by: syedfasih | last post by:
Hi, I am Syed Fasih ---this is my aspx.cs file for the page navigation. protected void grdConsultation_PageIndexChanging(object sender, GridViewPageEventArgs e) { ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.