Search code examples
jqueryasp.netcustomvalidator

Asp.net Custom Validator


I am performing both clientside validation and server side validation using jquery and Asp.net custom validator, required field validator.What i am doing is i display a 'X' next to the tetxbox which has wrong input.This is working fine , my issue is when a textbox has wrong input it shows 'X' as jquery validation function fires it , at the same time when he submits the data , custom validator also displays a 'X', so two 'X''X' are displayed like this, This kind of looks odd . So what can i do so that it is displayed properly , should i remove text from custom validator and only show error message on validation summary.any suggestions would be appreciated. Thanks


Solution

  • In my opinion keep using both, but just don't show 'X' on your jQuery validation. The Text attribute in the Custom Validator, will be seen in any case when submitting, and the ErrorMessage attribute on that validator, will appear in the summary. I have the same situation, and it works fine.

    Hopefully, it helps you.