rito1
asked on
W3C Validating an ASP.NET ImageButton control
Hi All,
I am trying to be a good boy and make sure my pages validate correctly via W3C's XHTML validator but what I have found is that the following control:
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/button_lo gon.png" PostBackUrl="page2.aspx" />
Viewing this within my browser outputs the following code:
<input type="image" name="ctl00$ImageButton1" id="ctl00_ImageButton1" src="images/button_mi_logo n.png" onclick="javascript:WebFor m_DoPostBa ckWithOpti ons(new WebForm_PostBackOptions(&q uot;ctl00$ ImageButto n1", "", false, "", "page2.aspx", false, false))" style="border-width:0px;" />
But the W3C validator sees this output html as:
<input type="image" name="ctl00$ImageButton1" id="ctl00_ImageButton1" src="images/button_mi_logo n.png" onclick="javascript:WebFor m_DoPostBa ckWithOpti ons(new WebForm_PostBackOptions(&q uot;ctl00$ ImageButto n1", "", false, "", "page2.aspx", false, false))" border="0" />
Has anyone experienced this or have any ways to resolve it?
Many thanks,
Rit
I am trying to be a good boy and make sure my pages validate correctly via W3C's XHTML validator but what I have found is that the following control:
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/button_lo
Viewing this within my browser outputs the following code:
<input type="image" name="ctl00$ImageButton1" id="ctl00_ImageButton1" src="images/button_mi_logo
But the W3C validator sees this output html as:
<input type="image" name="ctl00$ImageButton1" id="ctl00_ImageButton1" src="images/button_mi_logo
Has anyone experienced this or have any ways to resolve it?
Many thanks,
Rit
ASKER
Hi,
The problem is that .Net is outputting the Image button HTML with the HTML attribute border="0" when the W3C validator is checking it, which is non W3C non-compliant.
Is there any way of stopping asp.net from adding this border attribute and just get it's style from my CSS file?
Thanks,
Rit
The problem is that .Net is outputting the Image button HTML with the HTML attribute border="0" when the W3C validator is checking it, which is non W3C non-compliant.
Is there any way of stopping asp.net from adding this border attribute and just get it's style from my CSS file?
Thanks,
Rit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you both
Can you try to put ~ in the image source to tell compiler to navigate to your root folder?
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/button_
You might wanna try to remove the PostBackUrl (put back later) and put in the OnClick to see if there is any change.
Hope this help
JINN