views:

111

answers:

2

Basically is there a way to hook into when a RequiredFieldValidator does what it does? Like validator.ValidationCompleted ?

Normally for script controls, you can create an expose events so that you can listen to them from other controls, and I was asked if this is possible for the build in validation controls in asp.net but couldn't come up with a good way to do this. I was hoping that there is something built in that fires after a validator has completed it's task that can be captured client side.

A: 

Validators tend to operate client-side by default (EnabledClientScript defaults to True), but if you choose to push them server-side you simply need to look at the IsValid property of the Page to see if the validators were successful. You can look validator-by-validator server-side to determine which validators failed by iterating through the Page.Validators collection and checking each Validator for IsValid. If you wish you could change the way client-side validation is handled through this: http://msdn.microsoft.com/en-us/library/aa479045.aspx#aspplusvalid_clientside

Nissan Fan
A: 

Short answer: No.

You'll have to use a CustomValidator for client-side script you want to run when validation occurs. See the "ClientValidationFunction" property. Other options include 3rd party validation controls, or rolling your own.

Bryan