如何强制文本框只接受字符串 [英] how to force TextBox to only accept strings

查看:149
本文介绍了如何强制文本框只接受字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉的虚拟问题,我知道:( ,,但它仅仅是简单的事情,不和我一起工作:((

Sorry for the Dummy Question , i know :( ,, but it's only the simple things that dont work with me :((

我有很多文本框,我希望用户只能插入字符串,而不是数字的数字,
我怎么可以处理它简单的方法?
因为它需要每一件事,并将其应用到数据库,或者我应该从数据库控制它
PS。我寻觅了很多,但没有很好的答案

i have many text boxes and i want the user to only insert String and not Numeric numbers , how could i handle it in easy way ?? as it takes every thing and apply it to the database , or should i control it from the Database PS. i have searched a lot but with no good answer

推荐答案

使用[A-ZA-Z] +为ValidationEx pression:

use [a-zA-Z]+ for ValidationExpression:

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
    ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator" 
    ValidationExpression="[a-zA-Z]+"></asp:RegularExpressionValidator>

这篇关于如何强制文本框只接受字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆