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.

Published by

Unknown's avatar

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#, ASP.net, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

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

  1. 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 comment