Reputation: 10174
Everything works fine if I work with validators separately. But if I try to work with CustomValidator along with any other validator, CustomValidator does not work.
For example I have one RequiredFieldValidator and one CustomValidator that checks if textbox length is five
If I leave first textbox empty and fill seconf textbox interestingly only RequiredFieldValidator is working:
But if I fill both textboxes, both validators work.
My question is that Why CustomValidator did not work on first scenario
Upvotes: 1
Views: 925
Reputation: 3952
I feel that you use default options with RequiredFieldValidator which makes it run on client side and your custom validator works only on server side. So when you don't fill in first field RequiredFieldValidator check it and block postback cuz it run on client side. Then your custom validator will never be noticed cuz postback was blocked. In order to make RequiredFieldValidator work on server side set EnableClientScript = false
Upvotes: 2