The nowrap Property of TD Tags

Discussion in 'ASP .Net Building Controls' started by Nathan Sokalski, May 21, 2005.

  1. I want to create TD tags with the nowrap property. I have a user control
    which sets the Wrap property of a TableCell to False when dynamically
    creating a table as follows:

    cellCurrButton.Wrap = False

    When the code is run, this creates a TD tag that looks like the following:

    <td nowrap="nowrap"></td>

    However, when I edit the properties of a TD Tag created in Design, there is
    a property called nowrap which when set to True creates a TD Tag that looks
    like the following:

    <td nowrap></td>

    I prefer the second way because it is shorter and I also believe it is the
    correct HTML. However, because the TableCell object does not have this
    property, I cannot use it when creating generated TableCells. Why are these
    two outputs so different? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    Nathan Sokalski, May 21, 2005
    #1
    1. Advertising

  2. The first is XHTML and second is HTML 4 compatible.

    Cheers,
    Steve Goodyear
    Steve Goodyear, May 21, 2005
    #2
    1. Advertising

  3. On 5/20/05 20:49, in article , "Nathan
    Sokalski" <> wrote:

    > I want to create TD tags with the nowrap property. I have a user control
    > which sets the Wrap property of a TableCell to False when dynamically
    > creating a table as follows:
    >
    > cellCurrButton.Wrap = False
    >
    > When the code is run, this creates a TD tag that looks like the following:
    >
    > <td nowrap="nowrap"></td>
    >
    > However, when I edit the properties of a TD Tag created in Design, there is
    > a property called nowrap which when set to True creates a TD Tag that looks
    > like the following:
    >
    > <td nowrap></td>
    >
    > I prefer the second way because it is shorter and I also believe it is the
    > correct HTML. However, because the TableCell object does not have this
    > property, I cannot use it when creating generated TableCells. Why are these
    > two outputs so different? Thanks.


    nowrap="nowrap" is better since it is compliant to modern standards like
    XHTML. Standalone attributes are deprecated. In XHTML all attributes that
    were previously standalone must have value equal to the attribute name.

    VS 2003 is not XHTML compatible so Designer generates standalone attribute
    which is OK for HTML 4. VS 2005 Designer always generates nowrap="nowrap"
    since VS 2005 is XHTML compatible.

    What you see at runtime is HTML generated by ASP.NET runtime. ASP.NET
    controls try to generate XHTML whenever possible.

    Thanks
    Mikhail Arkhipov (Microsoft)
    -- This post is provided 'AS IS' with no warranties and confers no rights
    Mikhail Arkhipov (Microsoft), May 21, 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. Brian K. Williams

    TableCell oTableCell = new TableCell(); noWrap?

    Brian K. Williams, Apr 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,503
    Brian K. Williams
    Apr 30, 2004
  2. Nathan Sokalski

    The nowrap Property of TD Tags

    Nathan Sokalski, May 21, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,594
    Mikhail Arkhipov (Microsoft)
    May 21, 2005
  3. Kevin Lawrence

    nowrap not XHTML 1.0 compliant

    Kevin Lawrence, Jan 23, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    10,046
    Rob Roberts
    Jan 24, 2006
  4. Nathan Sokalski
    Replies:
    3
    Views:
    1,660
    Eliyahu Goldin
    Mar 28, 2007
  5. Nathan Sokalski

    The nowrap Property of TD Tags

    Nathan Sokalski, May 21, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    114
    Mikhail Arkhipov (Microsoft)
    May 21, 2005
Loading...

Share This Page