How to Fix the Error Message 'Attribute Border Exists But Can Not Be Used for This Element'

The error message "Attribute Border Exists But Can Not Be Used for This Element" appears when the markup validator at World Wide Web Consortium, or W3C, detects "asp:Image" or "asp:ImageButton" in a page containing ASP.NET. This error occurs even if the "border" attribute isn't included in the code. To work around the error, add the "<browserCaps>" tag -- an element that defines the settings and capabilities of a browser or browsers -- to your web.config file, then insert the W3C property assignments between the tags.

Instructions

    • 1

      Insert "<browserCaps>" and "</browserCaps>" in between the "<system.web>" and "</system.web>" tags in the web.config file:

      <system.web>
      <browserCaps>
      </browserCaps>
      </system.web>

    • 2

      Insert a case element in between the "<browserCaps>" and "</browserCaps>" tags:

      <browserCaps>
      <case match="W3C_Validator*>
      </browserCaps>

    • 3

      Add the TagWriter property to the code to define how Web controls should be rendered:

      <browserCaps>
      <case match="W3C_Validator*>
      TagWriter=System.Web.UI.HtmlTextWriter
      </case>
      </browserCaps>

    • 4

      Insert the W3C XML document object model (DOM) into the code:

      <browserCaps>
      <case match="W3C_Validator">
      TagWriter=System.Web.UI.HtmlTextWriter
      W3CDomVersion=1.0
      </case>
      </browserCaps>

    • 5

      Save the file to resolve the "Attribute Border Exists But Can Not Be Used for This Element" error.

Tips & Warnings

  • You can also work around this error by changing the value of "ClientTarget" to "uplevel" in your page directive: <%@ Page ClientTarget="uplevel" %>

Related Searches:

References

Comments

Related Ads

Featured