comparefieldvalidator control use for the comparing the data from one control to another control.
for ex:password and confirm password textbox control, if does not match then give the ErrorMessage Password does not match
code for this....
<table>
<tr>
<td>
Password
</td>
<td>
<asp:TextBox ID="txtpswd" runat="server" TextMode="Password" />
</td>
</tr>
<tr>
<td>
Repeat password
</td>
<td>
<asp:TextBox ID="txtconpswd" runat="server" TextMode="Password" />
<asp:CompareValidator ID="compswd" runat="server" ErrorMessage="Password does not match"
ControlToCompare="txtpswd" ControlToValidate="txtconpswd"></asp:CompareValidator>
</td>
</tr>
for ex:password and confirm password textbox control, if does not match then give the ErrorMessage Password does not match
code for this....
<table>
<tr>
<td>
Password
</td>
<td>
<asp:TextBox ID="txtpswd" runat="server" TextMode="Password" />
</td>
</tr>
<tr>
<td>
Repeat password
</td>
<td>
<asp:TextBox ID="txtconpswd" runat="server" TextMode="Password" />
<asp:CompareValidator ID="compswd" runat="server" ErrorMessage="Password does not match"
ControlToCompare="txtpswd" ControlToValidate="txtconpswd"></asp:CompareValidator>
</td>
</tr>



0 comments:
Post a Comment