**程序设计:**CompareValidator
代码:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
价格
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="输入大于0的数值" Operator="GreaterThan" Type="Double" ValueToCompare="0"></asp:CompareValidator>
<asp:Button ID="Button1" runat="server" Text="提 交" /></div>
</form>
</body>
</html>
运行结果: