仅输入文本框中的数字 [英] enter only numbers in Textbox

查看:69
本文介绍了仅输入文本框中的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好朋友,



我的项目基于Asp.net c#



用户必须只输入数字,而不是文本框中的字母。



请你建议我,怎么做。



请帮助帮助



提前致谢。

解决方案

有办法制作发生这种情况,使用正则表达式,JavaScript验证等。



我更喜欢 Masked Textbox : a href =http://www.codeproject.com/Articles/68834/Enhanced-Textbox-Control>增强的文本框控件 [ ^ ]


Google是你的朋友:好好经常拜访他。他可以比在这里发布问题更快地回答问题...



快速搜索得到超过400,000次点击: Google仅限数字textbox asp.net [ ^ ]



将来,请尽量自己做至少基础研究,不要浪费你的时间或我们的时间。


 <   asp:TextBox     ID   =  TextBox1    runat   = 服务器 > ;  <   / asp:TextBox  > ;  
< asp:RegularExpressionValidator ID = RegularExpressionValidator1 runat = server ControlToValidate = TextBox1

ErrorMessage = 输入有效数字 ValidationExpression = ^ \d

Hello Friends all of you,

My project is based on Asp.net c#

User must enter only numbers, not alphabets in textbox.

Please can u suggest me,how to do this.

Please help help help

Thanks in advance.

解决方案

There are ways to make this happen, using regular expression, JavaScript validation, etc.

I would prefer Masked Textbox for it: Enhanced Textbox Control[^]


Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave over 400,000 hits: Google "only numbers in textbox asp.net"[^]

In future, please try to do at least basic research yourself, and not waste your time or ours.


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"

        ErrorMessage="Enter a valid number" ValidationExpression="^\d


这篇关于仅输入文本框中的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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