【发布时间】:2012-03-16 06:47:37
【问题描述】:
我想验证日期时间,我的代码是:
[Range(typeof(DateTime),
DateTime.Now.AddYears(-65).ToShortDateString(),
DateTime.Now.AddYears(-18).ToShortDateString(),
ErrorMessage = "Value for {0} must be between {1} and {2}")]
public DateTime Birthday { get; set; }
但我得到了错误:
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
请帮帮我?
【问题讨论】:
标签: asp.net-mvc-3 validation date-range code-first