hits counter

The Cause Of ASP.NET Validators And Validation Summary Slowness

When building ASP.NET pages, if you use too many validators and validation summaries your pages can become very slow. Have you ever wondered why?

Lets build a simple page web page with a few validators. Something like this:

Web page with validation

The page is composed of:

ASP.NET renders the ValidationSummary as a DIV and each validator as a SPAN and uses expando attributes to add properties to those elements.

According to the documentation, expando attributes are set dynamically from JavaScript to preserve XHTML compatibility for the rendered control's markup.

The problem is that all that JavaScript makes the HTML document larger and slower to execute than if the properties were rendered in HTML as attributes of the elements.

For such a small page, the difference in size approaches 2k bytes. If you add a few dozen validators to he page, the slowness is noticeable.

I'm all in favor of strict standards and standards compliance, but in this case, I wish XHTML would allow arbitrary attributes.

No Comments