4
我wnat驗證日期時間,我的代碼是:MVC模型範圍驗證器?
[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
幫我嗎?