时间: 2021-07-31 作者:daque
rangevalidator控件[图5-12 rangevalidatorr树立对话框]不妨经过mininum value(最小值),maxinum value(最大值)来树立值的范畴。同声不妨经过type来树立比拟的典型,比方”string”,”integer”等。其余树立一致于其余组件的树立。再有一个组件:validationsummary。个中headertext树立昂首笔墨,displaymode树立表露形式,其简直属性如次:
属性值
意旨
list
bulletlist
singleparagraph
errormessage分行表露
errormessage分项表露
errormessage表露成同一条龙
[图5-13 validationsummary属性树立对话框]代附上重要步调段的源代码:< table width="75%" height="594" border="1" cellpadding="1" cellspacing="0" bordercolor="#999999" >< tr > < td width="22%" height="22" >first name< /td >< td width="38%" >< asp:textbox backcolor="#cccccc" forecolor="#0033ff" id="first" runat="server" textmode="singleline" tooltip="please input the first name" maxlength="40" borderwidth="1" width="200"/ >< /td >< td width="40%" >< asp:requiredfieldvalidator backcolor="#cccccc" controltovalidate="first" errormessage="requiredfield" forecolor="#ff0000" id="validname" runat="server" / > < /td >< /tr >< tr > < td height="22" >last name< /td >< td >< asp:textbox backcolor="#cccccc" forecolor="#0033ff" id="lastname" runat="server" textmode="singleline" width="200" tooltip="please input the last name" borderwidth="1"/ >< /td >< td >< asp:requiredfieldvalidator backcolor="#cccccc" controltovalidate="lastname" errormessage="requiredfield" forecolor="#ff0000" id="vaillast" runat="server" / > < /td >< /tr >< tr > < td height="22" >telephone< /td >< td >< asp:textbox backcolor="#cccccc" borderwidth="1" forecolor="#0066ff" id="telephone" runat="server" textmode="singleline" tooltip="please input your telephone" width="200" / >< /td >< td > < asp:regularexpressionvalidator backcolor="#cccccc" controltovalidate="telephone" errormessage="7-10 numbers required" forecolor="#ff0000" id="vailtel" runat="server" validationexpression="[0-9]{7,10}" / > < asp:requiredfieldvalidator backcolor="#cccccc" controltovalidate="telephone" errormessage="requiredfield" forecolor="#ff0000" id="vailtel2" runat="server" / >< /td >< /tr >< tr > < td height="22" >email< /td >< td >< asp:textbox backcolor="#cccccc" borderwidth="1" forecolor="#0033ff" id="email" runat="server" textmode="singleline" tooltip="please input your e-mail" width="200"/ >< /td >< td >< asp:regularexpressionvalidator backcolor="#cccccc" controltovalidate="email" errormessage="invaliate email address" forecolor="#ff0000" id="valiemail" runat="server" validationexpression=".{1,}@.{3,}" / > < asp:requiredfieldvalidator backcolor="#cccccc" controltovalidate="email" errormessage="required field" forecolor="#ff0000" id="valiemail2" runat="server" / > < /td >< /tr >< tr > < td height="22" colspan="3" >< div align="center" >comments< /div >< /td >< /tr >< tr > < td height="188" colspan="3" >< div align="center" > < asp:textbox backcolor="#cccccc" borderwidth="1" forecolor="#0033ff" id="comments" rows="16" runat="server" textmode="multiline" tooltip="please input the comments" width="400"/ >< /div >< div align="center" > < br >< /div >< /td >< /tr >< tr >< td height="71" colspan="3" >< div align="center" >< asp:validationsummary backcolor="#cccccc" displaymode="bulletlist" forecolor="#ff0000" headertext="有误的实质囊括:" id="valsum" runat="server" tooltip="error" / >< /div >< /td >< /tr >< tr > < td height="22" colspan="3" >< input type="submit" name="submit" value="submit" > < /td >< /tr >< /table >款式如次:[图5-14 预览]