ASP.Net 2.0 menu rendering differently in browser and at w3.org validator

I ran in to something strange today...

The ASP.Net 2.0 Menu control renders differently in a browser and in the W3 validator. Loading the page in a browser results in the usage of the correct attribute 'vertical-align' for the image which is used to indicate a menu has subitems. I checked this in IE and FireFox and both browsers rendered correct XHTML. When you copy the source of the rendered page and paste it in the validator-textbox at W3.org, it validates the XHTML. When you check the page directly by entering a URL, the menu renders using the non-correct attribute 'valign', causing my page to fail validation.  But the copied source passes validation!

I'll investigate this strange behaviour and get back at you when I find something. If you know where this is comming from: drop me a line in the comments.

Published Fri, Nov 25 2005 12:24 AM by Rick van den Bosch
Filed under:

Comments

# re: ASP.Net 2.0 menu rendering differently in browser and at w3.org validator

I've already expressed my distaste for all these supposed "accessibility friendly" controls that have been introduced. It does increase reliance on stock controls and less on the abilities of the programmer - resulting in a degree of false faith.

My approach: do it yourself, but use the XHTML output of ASP.NET 2.0 to ensure a strong control.

Thursday, November 24, 2005 11:08 PM by Nathan Pledger

# re: ASP.Net 2.0 menu rendering differently in browser and at w3.org validator

Rick, check out this blog post: http://idunno.org/displayBlog.aspx/2005080101. The root cause is that the ASP.NET 2.0 browser sniffing (in the default configuration) doesn't recognize the W3C Validator. It is then treated as a down-level browser. The post links to a w3cvalidator.browser file that you can use to remedy this.

Friday, November 25, 2005 3:53 AM by Erwyn van der Meer

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 2 and 3 and type the answer here: