I have these two fields in my model:
[Required(ErrorMessage="The start date is required")]
[Display(Name="Start Date")]
[DisplayFormat(DataFormatString = "{0,d}")]
public DateTime startDate { get; set; }
[Required(ErrorMessage="The end date is required")]
[Display(Name="End Date")]
[DisplayFormat(DataFormatString = "{0,d}")]
public DateTime endDate{ get; set; }
I require that endDate
must be greater than startDate
. I tried using [Compare("startDate")]
but this only works for the equal operation.
What should I use for the "greater than" operation?
See Question&Answers more detail:os