HTML Validation Fails due to asp:ImageButton?
Re: W3C Validation Fails due to asp:ImageButton rendering a phantom B...
View Complete Thread
Re: W3C Validation Fails due to asp:ImageButton rendering a phantom BUTTON="_" attribute
Jan 24, 2006 05:29 AM
Finally, 1 month later I received the correct workaround from Microsoft support.
Is a sort of misunderstanding between W3C validator and ASP.NET that can be resolved (for validation purposes) as follows.
"You should be able to view the source of the page in Internet Explorer by choosing "Source" from the browser's "View" menu.
As you can see above, the source being generated in XHTML compliant. You're seeing otherwise, of course, but that is likely to be because you are attempting to request the page using the W3C's validator instead of a desktop browser. Because the W3C validator returns a User-Agent header that isn't recognized by ASP.NET, content appropriate for older browsers that should be compliant with HTML 4.0 Transitional -- but not necessarily any of the XHTML language flavors -- will be generated.
There are a few options available to you if you need to validate your content using the W3C's validator service, you have a couple options:
1. You could use the "Source" item in the browser's "View" menu to view the source in Notepad, save that file locally, and then upload it to the W3C's Validator service for validation using the file upload interface.
2. You could change the "ClientTarget" attribute on your page's Page directive to always generate uplevel content."
The second, of course, is the only practical workaround if you need to certify the website for direct online validation on W3C validator.
So just enter ClientTarget="uplevel" in your page's Page directive and everything will be allright.