Validate Password and Confirm Password using CompareValidator

When you want to compare Password and Confirm Password Textbox value, you can use CompareValidator using below code.

<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" />
<asp:RequiredFieldValidator ID="RequiredPass" runat="server" ControlToValidate="txtPassword" Text="*" />

Confirm Password <asp:TextBox ID="txtPasswordCompare" runat="server" TextMode="Password" />
<asp:CompareValidator runat="server" ID="ComparePass" ControlToValidate="txtPassword" ControlToCompare="txtPasswordCompare" Text="Password mismatch" />

3 comments:

  1. protected void btnGetExperiance_Click(object sender, EventArgs e)
    {
    TxtExperiance.Text = (Convert.ToDateTime(txtEnddate.Text)).Year.
    (Convert.ToDateTime(txtStartdate.Text)).ToString();
    }

    ReplyDelete
  2. protected void btnGetExperiance_Click(object sender, EventArgs e)
    {
    TxtExperiance.Text = (Convert.ToDateTime(txtEnddate.Text)).Year.
    (Convert.ToDateTime(txtStartdate.Text)).ToString();
    }
    //solve this error

    ReplyDelete
  3. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
    or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete