We help IT Professionals succeed at work.

Compare Password and Confirm Password

net_susan
net_susan asked
on
Medium Priority
350 Views
Last Modified: 2010-05-18
How can I make sure that password and confirm password match?

<tr>

<td width="140" align="right">
<font color="#ff0000">*</font> <font class="formtext">Password:</font>
</td>

<td width="10">&nbsp;</td>
<td>
<asp:TextBox runat="server" id="password" Columns="18"></asp:TextBox>
</td>

<td width="15">
&nbsp;
</td>

<td width="185" align="right">
<font color="#ff0000">*</font> <font class="formtext">Confirm Password:</font>
</td>

<td width="10">&nbsp;</td>

<td>
<asp:TextBox runat="server" id="confirmpw" Columns="18"></asp:TextBox>
</td>

</tr>
Comment
Watch Question

In the onlick button

C#
if( password.Text == confirmpx.Text) //The passwords match

VB
If password.Text = confirmpx.Text Then 'Passwords match

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Ramesh SrinivasTechnical Consultant
CERTIFIED EXPERT
Commented:
Why? does this not work??

On your buttonclick event:

If password.text = confirmpw.text Then
  ... do whatever..
End if
Commented:
Hello

you can use comparevalidator:

<asp:comparevalidator id="valCmpResgistrationtxtCnfPass" Runat="server" CssClass="text" ErrorMessage="Both password should be same." ControlToValidate="password"  controlToCompare="confirmpx"></asp:comparevalidator>



Avanish

Author

Commented:
Thank you!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.