asp.net-mvc – ASP.NET MVC 4邮政编码验证
发布时间:2020-12-16 04:19:26 所属栏目:asp.Net 来源:网络整理
导读:我正在使用ASP.NET MVC 4,我正在寻找邮政编码验证的属性 [Required(ErrorMessage = "Zip Code is Required")][ZipCode]public string ZipCode { get; set; } 我知道这不起作用,但这正是我要找的. 谁能帮忙 我需要美国的Zip 解决方法 你需要使用正则表达式.尝
我正在使用ASP.NET MVC 4,我正在寻找邮政编码验证的属性
[Required(ErrorMessage = "Zip Code is Required")] [ZipCode] public string ZipCode { get; set; } 我知道这不起作用,但这正是我要找的. 谁能帮忙 我需要美国的Zip 解决方法
你需要使用正则表达式.尝试这样的事情.
[Required(ErrorMessage = "Zip is Required")] [RegularExpression(@"^d{5}(-d{4})?$",ErrorMessage = "Invalid Zip")] public string Zip { get; set; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 有人可以向我介绍asp.net路由语法吗?
- asp.net – 如何将JsonResult对象作为字符串获取,以便我可以
- asp.net – AppHarbor:不允许使用目录’/ App_GlobalResou
- asp.net – 将machineKey添加到machine.config
- MONO / ASP.NET Linux主机?
- asp.net-mvc – MVC4 Web Api中的[Bind(Prefix =“principa
- 难道.NET Core到R2连中文编码都不支持吗?
- asp.net-mvc-4 – 带有TextBoxFor的MVC在循环中具有相同的i
- asp.net – 在设计器视图中打开项目时,Visual Studio崩溃
- asp.net AJAX实现无刷新获得数据
推荐文章
站长推荐
- asp.net+jquery ajax无刷新登录的实现方法
- asp.net – Repeater的SeparatorTemplate与Eval
- Asp.Net(MVC):哪个会话超时是什么?
- asp.net – 程序集与Windows Azure上的IIS使用的
- asp.net-mvc – 如何在ASP.NET MVC中要求X.509证
- asp.net-mvc – 将JWT令牌存储在cookie中
- asp.net – Windows Azure一般问题
- asp.net-mvc – 在MVC 4应用程序中处理带有自定义
- asp.net – 如何在Visual Studio 2015中运行inde
- ASP.NET的延迟作业是否运行异步代码?
热点阅读