Image button found guilty of not being valid xhtml horror!!!

The .net image button seems so innocent but a trip over to and the html validator soon exposes the terrible truth. Prepare yourself for this, sit down, have a large brandy ready… It renders border=”0″ even though you haven’t put one in there yourself! try it! Put any xhtml 1.0 transitional site into the validator:

And watch in utter horror while your site is rejected as a bad example to kids everywhere.

So what is going on here? And is there anyway out?

Well after some digging I found an excellent article:

It turns out the validator is unrecognised as a browser type to and so is presented with html 4.0 instead of xhtml, hence the border=”0″ debarkle.

Is there a workaround? Yes there is either don’t use image buttons or put this in your web.config:

case match=W3C_Validator*>
TagWriter = System.Web.UI.HtmlTextWriter
W3CDomVersion = 1.0

A solution to a weird problem, but necessary if like me you want that green tick 🙂

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter
Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Image button found guilty of not being valid xhtml horror!!!”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Stay in contact!

Email Dave Riley
Dave Riley's Linkedin Profile
Dave Riley's Facebook Profile
Dave Riley's Twitter Profile
Dave Riley's Plaxo Profile