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:
The page is composed of:
- 2 TextBoxes
- 1 RequiredFieldValidator for each TextBox
- 1 RangeValidator for each TextBox
- 1 CompareValidator
- 1 ValidationSummary
- 1 Button
ASP.NET renders the ValidationSummary as a DIV and each validator as a SPAN and uses expando attributes to add properties to those 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.