asp:imagebutton border not validating to xhtml standards




asp:imagebutton border not validating to xhtml standards
If you're having problems validating your web pages to XHTML standards, the reason is because it renders it's controls using old school HTML so uses border="0" instead of the CSS equivalent which would be style="border-style: none;" when used in-line.  Now you might think a way around this is to use CSS or event use the BorderStyle="None" and BorderWidth="0px" attributes of the asp:imagebutton, but they don't work.

So if you code looked like this:

CSS Code:
  1. .noborder   
  2. {   
  3.     border-style: none;   
  4. }  
Asp.net Code:
  1. <asp:imagebutton id="ib1" runat="server" imageurl="~/images/image.gif" cssclass="noborder" />  
Then you should consider keeping your CSS code as it is and changing the asp:imagebutton code to the below:
  1. <asp:linkbutton id="LinkButton1" runat="server">  
  2.             <asp:image id="img1" runat="server" imageurl="~/images/image.gif" cssclass="noborder" />  
  3. </asp:linkbutton>   
It's just like placing an '<img />' tag inside an '<a></a>' tags.


No one has said that they like article yet, be the first and click here (0)
Send a link to this page via email Send a link to this page