Question problem with compare validator

pooya1072

Well-known member
Joined
Jul 5, 2012
Messages
84
Programming Experience
Beginner
hi
i have 2 textbox in my webform ; for type and retype the password.i put a compare validator to control the second textbox so it's value be equal by first textbox.so i enter the password in first textbox .at this time second textbox is empty.but compare validator don't work.only if i enter a non equal value by first textbox , the compare validator work .why it happen?
 
May I suggest in future that, if you try to use something and it doesn't work, the first thing you do is read the documentation for the class or member that you're trying to use? The documentation is there for a reason. Use it. This is from about 10 seconds worth of reading into the documentation for the CompareValidator class:
Validation succeeds if the input control is empty. Use a RequiredFieldValidator control to require the user to enter data into the input control.
 
You have to use required field validator and compare validator both for the confirm password input.So,if the user leave text box empty it shows required field validation and if user enter different value than the password field it shows password not matched validation.
 
You have to use required field validator and compare validator both for the confirm password input.So,if the user leave text box empty it shows required field validation and if user enter different value than the password field it shows password not matched validation.

I wish I'd said that 4 1/2 years ago. Oh look, I did! ;-)
 
Back
Top