Re: Question regarding W3C validator and ASP.NET

Ok, here's some example output given the 3 possible xhtml conformance
modes offered by asp.net

 

<xhtmlConformance mode="Legacy"/>

<body>

    <form name="form1" method="post" action="default.aspx" id="form1">

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJNzgzNDMwNTMzZGSXoVqQ0i3LT5svrbSOWojE+R7IzA==" />

 

    <div>

    

    </div>

    </form>

</body>

 

<xhtmlConformance mode="Transitional"/> 

<body>

    <form name="form1" method="post" action="default.aspx" id="form1">

<div>

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJNzgzNDMwNTMzZGSXoVqQ0i3LT5svrbSOWojE+R7IzA==" />

</div>

 

    <div>

    

    </div>

    </form>

</body>

 

<xhtmlConformance mode="Strict"/>

<body>

    <form method="post" action="default.aspx" id="form1">

<div>

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJNzgzNDMwNTMzZGSXoVqQ0i3LT5svrbSOWojE+R7IzA==" />

</div>

 

    <div>

    

    </div>

    </form>

</body>

 

You'll notice that in both transitional and strict modes, the viewstate
field gets wrapped in a div. Running each of these through the w3c
validator shows that this does in fact solve the validation error
regarding the underscore character in the id attribute, but if the rule
says 'id's can't start with an underscore I don't understand how the
extra div helps; the input id still starts with an underscore!

Matt Salmon
Head of Programming 

 

Liverpool Science Park
131 Mount Pleasant
Liverpool L3 5TF 

t: +44 (0) 845 365 4040
f: +44 (0) 845 365 4041
w: www.mandogroup.com <http://www.mandogroup.com/>  

Mando Group Ltd
Registered in England 04391789 

 

________________________________

The contents of this email are strictly private and confidential and are
intended solely for the named addressee[s] only. If you are not the
intended recipient, you should not copy it or use it for any purpose,
nor disclose its contents to any other person and you should return this
message to the sender and delete it from your mailbox. The views and
opinions expressed in this email do not necessarily represent those of
Mando Group. Please note that whilst Mando Group does check for viruses,
it is the responsibility of the recipient to scan all messages prior to
opening them. 

________________________________

 

Received on Tuesday, 2 June 2009 09:16:22 UTC