Compare Password and Confirm Password

Posted on 2006-03-22
Last Modified: 2010-05-18
How can I make sure that password and confirm password match?


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

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

<td width="15">

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

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

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

Question by:net_susan
    LVL 15

    Assisted Solution

    In the onlick button

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

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

    LVL 11

    Assisted Solution

    Why? does this not work??

    On your buttonclick event:

    If password.text = confirmpw.text Then
      ... do whatever..
    End if
    LVL 4

    Accepted Solution


    you can use comparevalidator:

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

    LVL 1

    Author Comment

    Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now