How to validate password and confirm password using CompareValidator?

Poster
Posted by Poster under ASP.NET category on | Views : 40136
To validate password and confirm password using CompareValidator, use following code.


<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" />
<asp:RequiredFieldValidator ID="req6" runat="server" ControlToValidate="txtPassword" Text="*" />
Confirm Password <asp:TextBox ID="txtPasswordC" runat="server" TextMode="Password" />
<asp:CompareValidator runat="server" ID="Comp1" ControlToValidate="txtPassword" ControlToCompare="txtPasswordC" Text="Password mismatch" />


Thanks

Comments or Responses

Login to post response