The .net image button seems so innocent but a trip over to w3c.org 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 asp.net 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:
TagWriter = System.Web.UI.HtmlTextWriter
W3CDomVersion = 1.0
A solution to a weird problem, but necessary if like me you want that green tick 🙂