zl程序教程

您现在的位置是:首页 >  其它

当前栏目

3.5使用RangeValidator控件

使用 控件 3.5 RangeValidator
2023-06-13 09:12:30 时间

大家好,又见面了,我是你们的朋友全栈君。使用RangeValidator控件

检测表单字段的值是否在指定的最小值和最大值之间 五个属性: ControlToValidate—被验证的表单字段的ID Text --验证失败时显示的错误信息 MininumValue MaxinumValue Type-比较类型:String,Integer,Double,Date和Currency 默认为String

[code] <%@ Page Language=”C#” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <script runat=”server”>

</script> <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> <title>Show RangeValidator</title> </head> <body> <form id=”form1″ runat=”server”> <div> <asp:Label ID=”lblAge” Text=”Age:” AssociatedControlID=”txtAge” runat=”server” /> <asp:TextBox ID=”txtAge” runat=”server” /> <asp:RangeValidator ID=”reqAge” ControlToValidate=”txtAge” Text=”(Invalid Age)” MinimumValue=”5″ MaximumValue=”100″ Type=”Integer” runat=”server” /> <br /> <br /> <asp:Button ID=”btnSubmit” Text=”Submit” runat=”server” /> </div> </form> </body> </html> [/code]

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/159267.html原文链接:https://javaforall.cn