ASP.net: Custom Validator Not Firing (working)

The built in ASP.net CustomValidator control does not on its own verify that the control you are validating is not empty and therefore will not fire if it is empty. Because of this you cannot rely on the Custom Validator to handle the duties of a Required Field Validator.
So if the field you are implementing custom validation on is required and you want that custom validation to happen every time the page is posted you need to add a RequiredFieldValidator to validate the control as well as the CustomValidator.

One thought on “ASP.net: Custom Validator Not Firing (working)

  • Thanks, this saved me alot of debug time!

    I just didn't understand why the event was not firing.
    By the way you can still get the custom validator to fire if you set the ValidateEmptyText property to true.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s