且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

防止文本框输入字符串

更新时间:2022-12-20 11:53:31

您只需将 MaxLength = 10 赋予文本框txtMobileNumber.

您可以使用 RegularExpression [ javascript [
You just give MaxLength=10 to the textbox txtMobileNumber.

You can use RegularExpression[^] or javascript[^]

Do customizations based on your need, that''s all.


为此,您可以使用仅包含数字的正则表达式.
有关详细信息,请看看
For that, you can use regular expressions, that takes onl y numbers.
For details, Have a look


您可以使用RegularExpression查找文本是否为数字.
下面是代码

You can use RegularExpression to find whether the text is number.
Below is the code

System.Text.RegularExpressions.Regex regularExpression = new System.Text.RegularExpressions.Regex("^-[0-9]+