Possible Duplicate:
validation problem in asp.net login control
I have asp.net login control in my web application. When I give the incorrect username and password and click the login button the failure text will appeared. Then clear the password field then click the login button both failure text and passwordrequirederrormessage validation messages will appeared. But I need only the password requirederrormessage will appeared. Can anyone able to g开发者_如何学Cive the solution for that. Thank you
If you are checking the username/password in a Click event, make sure to check the page's IsValid property before continuing. If username/password are being validated through a validation control, set its EnableClientScript to false and the RequiredFieldValidator to true. This will prevent the form from submitting without a password and the second validator from being called, unless they have JavaScript turned off.
精彩评论