ServerSideValidationExtender doesn't function after postback

Jan 19, 2008 at 1:36 AM
I'm trying to use the ServerSideValidationExtender with the PropertyProxyValidator inside a FormView bound to an ObjectContainerDataSource. The validation works as expected if the FormView is not bound, however, once I bind the FormView the validation events will not fire using the partial post back. The validation does occur when the form is submitted.

Has anybody else encountered this problem? Does anyone know a way to get this to work?

Jan 22, 2008 at 9:40 PM
Further testing has shown that the problem isn't with databinding the form, it is with the postback. I've stepped through the client script in the debugger and found that the validator's evaluationfunction isn't defined after the page is submitted the first time.

It's strange that the validator's controltovalidate is still defined, and both properties are set in the same block of code.

Has anyone else run into this problem?
Jan 23, 2008 at 1:22 AM
I solved the problem. The ServerSideValidationExtender was using the ClientScriptManager.RegisterExpandoAttribute method instead of the ScriptManager method.

In ServerSideValidationExtender.cs I changed

cm.RegisterExpandoAttribute(controlId, "evaluationfunction", "GenericServerSideValidationEvaluateIsValid", false);

ScriptManager.RegisterExpandoAttribute(this, controlId, "evaluationfunction", "GenericServerSideValidationEvaluateIsValid", false);