控件名 | 功能描叙 |
requiredfieldvalidator(必须字段验证) | 用于检查是否有输入值 |
comparevalidator(比较验证) | 按设定比较两个输入 |
rangevalidator(范围验证) | 输入是否在指定范围 |
regularexpressionvalidator(正则表达式验证) | 正则表达式验证控件 |
customvalidator(自定义验证) | 自定义验证控件 |
validationsummary(验证总结) | 总结验证结果 |
<asp:requiredfieldvalidator id="validator_name" runat="server" controltovalidate="要检查的控件名" errormessage="出错信息" display="static|dymatic|none" > 占位符</asp: requiredfieldvalidator > |
<asp:textbox id="txtname" runat="server"/><asp:requiredfieldvalidator id="validator1" runat="server" controltovalidate="txtname" errormessage="姓名必须输入" display="static"> *姓名必须输入</asp:requiredfieldvalidator> |
<form runat="server">其他代码</form> |
<asp:comparevalidator id="validator_id" runat="server" controltovalidate="要验证的控件id" errormessage="错误信息" controltocompare="要比较的控件id" type="string|integer|double|datetime|currency" operator="equal|notequal|greaterthan|greatertanequal|lessthan|lessthanequal|datatypecheck" display="static|dymatic|none" >占位符</asp:comparevalidator> |
<asp:rangevalidator id="vaidator_id" runat="server" controltovalidate="要验证的控件id" type="integer" minimumvalue="最小值" maximumvalue="最大值" errormessage="错误信息" display="static|dymatic|none" >占位符</asp:rangevalidator> |
<asp:regularexpressionvalidator id="validator_id" runat="server" controltovalidate="要验证控件名" validationexpression="正则表达式" errormessage="错误信息" display="static" >占位符</asp:regularexpressionvalidator> |
<asp:validationsummary id="validator_id" runat="server" headertext="头信息" showsummary="true|false" diaplaymode="list|bulletlist|singleparagraph" ></asp: validationsummary > |
<asp:customvalidator id="validator_id" runat="server" controltovalidate="要验证的控件" onservervalidatefunction="验证函数" errormessage="错误信息" display="static|dymatic|none" >占位符</asp: customvalidator > |
新闻热点
疑难解答
图片精选