ASP .NET MVC 3数据注释GREATERTHAN LowerThan datetime和INT [英] ASP .NET MVC 3 Data Annotations GreaterThan LowerThan for DateTime and int

查看:158
本文介绍了ASP .NET MVC 3数据注释GREATERTHAN LowerThan datetime和INT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是有大于号&放大器最简单的方法; 低于一个ASP.NET MVC 3表单验证?

I would like to know what is the easiest way to have a "Greater Than" & "Lower Than" validation on a ASP.NET MVC 3 form?

我使用的客户端验证非侵入式JavaScript。
我有两个日期时间属性(起始日期和放大器;结束日期),我需要一个验证,以确保该结束日期比起始日期越大。
我有另一种形式,我有一个MINVALUE(INT)及其他类似的案件; MaxValue的(INT)。

I use unobtrusive JavaScript for client validation. I have two DateTime properties (StartDate & EndDate) and I need a validation to be sure that the EndDate is greater than the StartDate. I have another similar case with another form on which I have a MinValue (int) & MaxValue (int).

请问这种类型的验证默认情况下是否存在?还是没有人知道这解释了如何实现的呢?一篇文章

Does this type of validation exist by default? Or does someone know an article which explains how to implement it?

推荐答案

再去看看 dataannotationsextensions 的它确实最小值/最大值为INT

Could look at the dataannotationsextensions it does Min/Max for int

也有看一个万无一失验证该inlcudes为GREATERTHAN比较数字/日期等

Also have a look at a foolproof validation it inlcudes GreaterThan comparison for numeric/datetime etc

这篇关于ASP .NET MVC 3数据注释GREATERTHAN LowerThan datetime和INT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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