移动领域接受的数字不到10位 [英] less than 10 digit is accepted in mobile field
本文介绍了移动领域接受的数字不到10位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题是在应用此类验证后,数据在数据库中插入的数字少于10位。如何解决它。
the problem is data is inserted less than 10 digit in database after applying such validation. how to solve it.
<asp:TextBox runat="server" ID="txtMobile" MaxLength="12" />
<asp:RequiredFieldValidator ID="Requiredfieldvalidator2" runat="server" ControlToValidate="txtMobile" ValidationExpression="^[0-9]{10,12}$"
ValidationGroup="entry"><img src="../images/erroricon.png" alt="error" /></asp:RequiredFieldValidator>
<ajaxToolKit:FilteredTextBoxExtender ID="fltMobile" runat="server" TargetControlID="txtMobile"
FilterType="Numbers">
</ajaxToolKit:FilteredTextBoxExtender>
推荐答案
< span class =code-attribute> ValidationGroup = 条目 > < img src = ../ images / erroricon.png alt = error / > < span class =code-keyword>< / asp:RequiredFieldValidator >
< ajaxToolKit:FilteredTextBoxExtender ID = fltMobile runat = server TargetControlID = txtMobi le
< span class =code-attribute> FilterType = 数字 >
< / ajaxToolKit:FilteredTextBoxExtender >
" ValidationGroup="entry"><img src="../images/erroricon.png" alt="error" /></asp:RequiredFieldValidator> <ajaxToolKit:FilteredTextBoxExtender ID="fltMobile" runat="server" TargetControlID="txtMobile" FilterType="Numbers"> </ajaxToolKit:FilteredTextBoxExtender>
/^.{10,}
/
使用此< br $>
或
use this one
or
/[0-9a-zA-Z]{10,}/
这里是示例
here is the example
<asp:TextBox id="txtUsername" runat="server" />
<asp:RegularExpressionValidator
id="RegularExpressionValidator1"
runat="server"
ErrorMessage="Field not valid!"
ControlToValidate="txtUsername"
ValidationExpression="[0-9a-zA-Z]{10,}" />
关于......:)
regards...:)
这篇关于移动领域接受的数字不到10位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文