ASP.NET Adaptive Rendering and Validator Controls
Posted in Development
After Scott Mitchell published an article on adaptive rendering I couldn't help wondering what happens to client side validation. You can change the HMTL writer class so server controls would emit the same code for Internet Explorer, Mozilla and Opera, but validators won't work. There's a simple reason for that: Microsoft folks utilize their own proprietary way of referring to controls on a page via document.all ["xxxxx"].
Opera has a user agent setting where you tell it to fake IE, but what's the point? Controls will render validation JavaScript code it won't understand.

I guess there are two options at this point:
- Buy a revamped library of validation controls along with corrected JavaScript code, or
- Wait until ASP.NET 2.0 ships.
Or... you can settle for client-side validation in IE, and server side validation in all other browsers. But, quite honestly, this is not fun.
3 comments
Jesus Barrios
on December 10, 2004
I don't understand why Microsoft don't support IE WEB Controls currently. What we will do with the developments than used this server controls? What say Microsoft?
Milan Negovan
on December 11, 2004
To be honest, you're better off not relying on IE web controls. I never liked them. I think they were written more like server control samples. For example, the tree control posts back on every click. Why? Who in sane mind would use a tree that triggers so many roundtrips? Also, their tab control in awful. I don't know if they are committed to even support them.

Stefano
on September 7, 2004
Decompiling System.Web.UI.WebControls of the v.2.0b i'll see that document.all is always present.
protected virtual void RegisterValidatorDeclaration()
{
string str = String.Concat("document.all[\"", base.ClientID, "\"]");
base.Page.ClientScript.RegisterArrayDeclaration("Page_Validators", str);
}
Nothing to wait at this point, just rewrite the controls.