文本框只允许字母.......在C#文本显示代码只允许在C#使用相同的字母数字
it1352
帮助1人
问题说明
文本框只允许字母.......显示c中的代码
文本只允许在c#中使用相同的字母数字
我尝试了什么:
告诉我c#asp.net中的代码
textbox only allow letter....... show the code in c#
text only allow alphanumeric same in c#
What I have tried:
just tell me the code in c#asp.net
正确答案
#1
谷歌是你的朋友。例如,参见 c# - 如何制作一个文本框只接受号码? - 堆栈溢出 [ ^ ]。虽然不能完全解决您的问题,但第一个答案说明了该技术。
Google is your friend. See for instance c# - How do I make a textbox that only accepts numbers? - Stack Overflow[^]. While not exactly solving your problem, the first answer illustrates the technique.
对于ASP.NET,您不希望在C#中执行此操作 - 您希望在JavaScript中执行此操作,以便用户无法输入不良信息。在C#中执行此操作意味着在用户完成整个表单或每个字符时往返服务器。前者对于用户来说是一种痛苦,因为他们最后被告知这是错误的并且必须回去修复它,后者是缓慢而笨拙的。使用JS意味着它在客户端完成,服务器不参与。
Javascript验证:使用JavaScript验证TextBox [ ^ ]
For ASP.NET you don't want to do it in C# - you want to do it in JavaScript so that the user can't enter "bad" info. Doing it in C# means a round trip to the server either when the user is finished with the whole form, or for each character. The former is a pain for the user as they get told at the end "that was wrong" and have to go back to fix it, the latter is slow and awkward. Using JS means it's done at the client end and the server isn't involved.
Javascript validation: Validate TextBox using JavaScript[^]
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfjjff
系列文章
更多
同类精品
更多
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20