Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Possible XHTML bug with <asp:Table> tag and HorizontalAlign property

Reply
Thread Tools

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

 
 
Mark Rae
Guest
Posts: n/a
 
      11-05-2006
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" >
....
....
....
<aspanel 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>
<aspanel>

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


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11-05-2006
Mark,

Did you try simple

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

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


"Mark Rae" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" >
> ...
> ...
> ...
> <aspanel 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>
> <aspanel>
>
> 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
>



 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      11-05-2006
"Eliyahu Goldin" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...

> Did you try simple
>
> tblCart.Attributes["align"]="center"; ?


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


 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11-05-2006
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" <(E-Mail Removed)> wrote in message
news:%23nZ%(E-Mail Removed)...
> "Eliyahu Goldin" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
>
>> Did you try simple
>>
>> tblCart.Attributes["align"]="center"; ?

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



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      11-05-2006
"Eliyahu Goldin" <(E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...

> 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
if there was any way of persuading the <asp:Table> tag to generate
XHTML-compliant markup when using the HorizontalAlign tag.

> Does it work or no?


Yes of course it does.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataList HorizontalAlign not XHTML compliant Amil Hanish ASP .Net 0 03-12-2007 02:22 AM
Should I Convert Site To XHTML or XHTML mobile? chronos3d HTML 9 12-05-2006 04:46 PM
ItemStyle-HorizontalAlign="right" not working tshad ASP .Net 1 07-27-2006 11:47 AM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM



Advertisments