Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used Compare validator in a form to check the "Password" textbox with "Confirm Password" textbox.

Code i wrote in .aspx.cs file.

if(page.Isvalid)
{
label1.Text="Validation Successful";
}
else
{
label1.Text="Not Suceessful";f
}

Here when i enter same string in two textboxes, postaback is occuring.Label text is displaying. But when i am giving different text in the textboxes... page postback is not happening. Even it is not showing label text msg.
Can anyone plz help me out.
Posted
Comments
cuteband 6-Jun-11 4:10am    
change your compare validator with that ID you made

use the compare validator properties.

right click on compare validator, then properties.

from there, you will see the behaivior of the validator. just choose where to "control to validate" and "control to compare"



hope it helps.
goodluck. :)



-chaosgray-
 
Share this answer
 
Comments
Uday P.Singh 6-Jun-11 4:14am    
gud point :)
chaosgray 6-Jun-11 4:17am    
thanks. :)
Please do not store passwords in clear text! There is a tip/trick explaining why not here: Password Storage: How to do it.[^]
 
Share this answer
 
On the Properties Menu:

Choose Conrol to Validate property with Confirm Password and Control to Compare Property with Password.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900