Adaptive Rendering

Published 29 April 04 12:19 PM | Scott Mitchell

After yesterday's post on Panel Weirdness some questions from Milan Negovan prompted me to write an article on how ASP.NET employes adaptive rendering. The HTML markup emitted from a Web control depends on the browser requesting the page.

Behind the scenes, the Page class creates an HtmlTextWriter instance based on the Browser object's TagWriter property. By default, the TagWriter property refers to HtmlTextWriter, which emits HTML 4.0-compliant HTML markup. For non-Microsoft browsers, the Html32TextWriter class is used instead, which emits HTML 3.2-compliant HTML. All of this information, thankfully, is configurable through the <browserCaps> section.

One issue that configuring the <browserCaps> section doesn't address is the validation controls and their client-side validation scripts. This, really, is another can of worms, as the System.Web.UI.WebControls.BaseValidator class annoyingly uses document.all to reference the client-side validator controls. (document.all is not supported in non-Microsoft browsers.) The short of it is that you have to create your own set of validation controls, such as Paul Glavich's DomValidators, which starts from scratch with the creation of a BaseValidator class that uses document.getElementById() instead.

Read the article, A Look at ASP.NET's Adaptive Rendering

Filed under:


No Comments


My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.