6

如果我想验证文本框是否包含大于或等于零的整数。我是否需要使用两个 asp:CompareValidator 控件:一个带有 DataTypeCheck 运算符,一个带有 GreaterThanEqual 运算符?

还是数据类型运算符是多余的?我可以只使用带有 GreaterThanEqual 运算符(并且类型设置为 Integer)的单个验证器吗?

4

1 回答 1

15

这应该足够了

<asp:RangeValidator id="Range1"
           ControlToValidate="TextBox1"
           MinimumValue="0"
           MaximumValue="2147483647"
           Type="Integer"
           Text="The value must be integer and greater or equal than 0"
           runat="server"/>
于 2010-03-29T18:11:12.777 回答