ASP.NET HTML 控件 CompareValidator

asp.net html 控件 comparevalidator

<!doctype html>
<html>
<body>

<form runat="server">
<table border="0" bgcolor="#b0c4de">
   <tr valign="top">
     <td colspan="4"><h4>compare two values</h4></td>
   </tr> 
   <tr valign="top">
     <td><asp:textbox id="txt1" runat="server" /></td>
     <td> = </td>
     <td><asp:textbox id="txt2" runat="server" /></td>
     <td><asp:button text="validate" runat="server" /></td>
   </tr>
</table>
<br>
<asp:comparevalidator
id="compval" 
display="dynamic"
controltovalidate="txt1" 
controltocompare="txt2" 
forecolor="red" 
backcolor="yellow" 
type="string"
enableclientscript="false" 
text="validation failed!" 
runat="server" />
</form>

</body>
</html>
相关文章