Validating User Input against the Value in Another Control Using the CompareValidator Control (VB.net)
<%@ Page Language=VB Debug=true %>
<HTML>
<HEAD>
<TITLE>Validating User Input against the Value in Another Control Using the CompareValidator Control</TITLE>
</HEAD>
<form runat="server">
<BR><BR>
Enter the same value in both TextBox controls:
<BR>
<asp:textbox
id="txtSame1"
runat=server
/>
<BR>
<asp:textbox
id="txtSame2"
runat=server
/>
<asp:comparevalidator
id="cvCheckValues"
controltovalidate="txtSame1"
controltocompare="txtSame2"
runat=server
>
<BR>Please enter the same value in both boxes.
</asp:comparevalidator>
<BR><BR>
<asp:button
id="butOK"
text="OK"
type="Submit"
runat="server"
/>
</form>
</BODY>
</HTML>
Related examples in the same category