如何验证用户在ASP MVC4的文本框中输入字符串 [英] How to validate that user enters string in textbox in asp mvc4

查看:66
本文介绍了如何验证用户在ASP MVC4的文本框中输入字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证用户在asp mvc4的文本框中输入字符串? 在必需标签中写些什么?

How to validate that user enters string in textbox in asp mvc4? What to write in required tag?

            [required]

推荐答案

如果要限制用户仅输入字母字符,请使用[RegularExpression]属性.

Use the [RegularExpression] attribute if you want to limit the user to only typing in alphabetic characters.

更多信息在MSDN上.

此处是指向正则表达式的良好链接,可以使用.

Here is a good link to a regular expression that you can use.

这篇关于如何验证用户在ASP MVC4的文本框中输入字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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