Empty cell problem

Discussion in 'HTML' started by tshad, Jun 13, 2005.

  1. tshad

    tshad Guest

    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
     
    tshad, Jun 13, 2005
    #1
    1. Advertising

  2. tshad

    Toby Inkster Guest

    tshad wrote:

    > 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.)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Jun 13, 2005
    #2
    1. Advertising

  3. "tshad" <> wrote:

    > 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.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Jun 13, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.rcn.com
    Replies:
    1
    Views:
    9,675
    Chris Smith
    Jul 12, 2004
  2. Phillip Roncoroni
    Replies:
    14
    Views:
    1,099
    Toby A Inkster
    Apr 5, 2004
  3. Bill Gower

    Problem with empty cell value in GridView

    Bill Gower, Aug 6, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    1,034
    Mark Rae [MVP]
    Aug 7, 2007
  4. Empire City
    Replies:
    3
    Views:
    413
    Empire City
    Apr 30, 2004
  5. Thomasa Gregg
    Replies:
    1
    Views:
    159
    Eliyahu Goldin
    Jun 9, 2004
Loading...

Share This Page