The nowrap Property of TD Tags

N

Nathan Sokalski

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

Mikhail Arkhipov (Microsoft)

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
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top