如果用户在文本框中输入非数字和数字值,如何只保留数字部分?
Set the property "CausesValidation" to true. Set your validation to accept only an int or whatever sort of number you are looking for.
Perhaps see: Number validation in required field validator
You can use RegularExpressionValidator
Validate it against your control, with the validation Expression of {0:d} to permit only digits or {0:w} for letters and numbers as well.
您可以绑定到keydown事件,并且如果密钥不是0-9,则将其设置为true。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.