Empty cell problem

T

tshad

How do you handle empty cells in tables with borders?

I tried using empty-cells:show, but it doesn't work in IE. It does work in
all the other browsers, however.

I know I could use &nbsp in the empty cells, but that is difficult to do
when doing a databind in asp.

Thanks,

Tom
 
T

Toby Inkster

tshad said:
I know I could use &nbsp in the empty cells, but that is difficult to do
when doing a databind in asp.

Don't know much about ASP databinds, but can't you write a little function
that formats the data before spitting it out?

e.g.:

function myFormatString ($string)
{
if ($string=='')
{
return " "
}
else
{
$string = str_replace('&','&'$string);
$string = str_replace('<','&lt;'$string);
$string = str_replace('>','&gt;'$string);
return $string
}
}

And then use it like so:

print "<td>" . myFormatString($value) . "</td>\n";

??

(Obviously substituting VBScript/JScript/PerlScript for the PHP syntax
above.)
 
J

Jukka K. Korpela

tshad said:
How do you handle empty cells in tables with borders?

I avoid them by inserting suitable dummy or non-dummy content; see
http://www.cs.tut.fi/~jkorpela/HTML/emptycells.html
I tried using empty-cells:show, but it doesn't work in IE. It does
work in all the other browsers, however.

I bet you haven't tested all the other browsers; I bet you could not
even name them. But I'll buy the claim that it works on other browsers
that have a market share over 1% these days. The failure on IE 6
is a sufficient reason to think about something else, though.
I know I could use &nbsp in the empty cells, but that is difficult
to do when doing a databind in asp.

As Toby commented, it can be done.

But primarily, I think you should consider what would be the most
suitable non-blank content for cells that lack "real" content.
Sometimes it's a dash; sometimes "0"; sometimes "N/A"; or something
else.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top