views:

22

answers:

1

I am using ASP.NET's server-side validation. In the page_load event I'm calling Page.Validate(), and if Page.IsValid is not true I'm then polling the controls to figure out which ones are not valid, and then determining what actions to take.

It would be much easier if each control would raise an event as validation fails, allowing me to take action for that particular control. I'm very much a naive programmer when it comes to validation, but is there a way to extend these controls so that a validation error raises an event?

A: 

In order to do this, you would have to write your own subclass of each of the validators you want to use.

I haven't looked at the code for these validators in a long time, so I wouldn't be able to tell you if there were any issues in doing this.

Gabriel McAdams
Please remember to accept this answer if you found it useful.
Gabriel McAdams