I am trying to validate a year field in my model for a credit card. I want to grab the current year as the minimum value. Here is my code:
[Required]
[Range(DateTime.Now.Year, DateTime.Now.Year+20, ErrorMessage="Please enter a valid year")]
[Display(Name = "Exp. Year")]
public int expYear { get; set; }
The error I am getting is: "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type" on the "DateTime.Now.Year" code.