Possible XHTML bug with <asp:Table> tag and HorizontalAlign property

M

Mark Rae

Hi,

Consider the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
....
....
....
<asp:panel ID="pnlCart" Runat="server" HorizontalAlign="Center">
<asp:Table HorizontalAlign="Center" ID="tblCart" Runat="server"
BorderColor="White" BorderStyle="Solid" BorderWidth="1" GridLines="Both">
<asp:TableRow>
...
</asp:TableRow>
<asp:TableRow>
...
</asp:TableRow>
<asp:TableRow>
...
</asp:TableRow>
<asp:Table>
<asp:panel>

That produces the following HTML:

<div id="pnlCart" style="text-align:center;">
<table id="tblCart" align="Center" rules="all" border="1"
style="border-color:White;border-width:1px;border-style:Solid;">
<tr>
....
</tr>
<tr>
....
</tr>
<tr>
....
</tr>
</table>
</div>

This fails validation through http://validator.w3.org/ because of the
capitalisation of "Center" in align="Center". Even changing the <asp:Table
tag to spell it with a lower-case "c" i.e. HorizontalAlign="center" still
renders the HTML with a capital "C".

I don't want to use a textalign style, as that will center all the text
within the individual tablecells.

Has anyone else noticed this? Is there a way round it to pass XHTML
validation?

Any assistance gratefully received.

Mark
 
E

Eliyahu Goldin

The point is that it could be a work-around, one of the things you've asked
for. Does it work or no?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Mark Rae said:
Did you try simple

tblCart.Attributes["align"]="center"; ?

LOL! Yes, of course - but that's hardly the point!
 
M

Mark Rae

The point is that it could be a work-around, one of the things you've
asked for.

OK, I'm sorry - I didn't phrase my question clearly enough.

I was asking if the fact that the HorizontalAlign attribute of the
<asp:Table> tag generates non-compliant XHTML markup was a bug or not, and
Does it work or no?

Yes of course it does.
 

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,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top