.net - 最大年龄的数据注释大于最小年龄
问题描述
如何验证最大年龄应大于 mvc dot net 中数据注释中的最小年龄?
当用户输入表单时,我想使用 MVC dot net 中的数据注释来验证最大年龄是否大于最小年龄
In my case ,
public class ModelForm
{
[Required]
[Range(10,70,ErrorMesaage = "Enter the minimum age between 10 to 70 !" )]
public int MinAge {get;set;}
[Required]
[Compare("//Entered MinAge" , 80 , ErrorMessage = "Maximum Age Should be Greater than Minimum Age !" )]
public int MaxAge {get;set;}
}
解决方案
推荐阅读
- android-studio - 编辑文本 android studio
- javascript - 查找滚动何时进入底部和何时进入顶部
- android - 从 AppCompat 1.1 迁移到 AppCompat 1.2
- javascript - 为什么 document.execCommand("copy") 不起作用?
- node.js - 无法使用 Node.js 将记录插入 mongodb
- linux - 使用“getopts”和“case”错误处理输入
- android - 如何将 ValueAnimation 放入线程中?
- ios - 如何使用 CPTLegen 作为按钮切换图形可见性
- bash - 如何在shell中提取由分隔符分隔的位置值
- java - 如何清理 Mina FTP 服务器中的会话