ASP.NET MVC C# Data Annotations: Compare two values

I am trying to create a data annotation for my MVC model to validate two dates. I have a start date and end date, the end date should be greater than the start date. I have managed to create an annotation but cannot pass values to it. Does ayone have any idea how to do this?

Thanks

Answers


You can compare a DateTime object another object of this type. If the startdate and endate are both DateTime objects the Compare method should do the trick.


Need Your Help

Can i apply CSS based on index?

html css

Lets say i have 50 element grid. If its wide list it is easy for readers if i color odd and even div differently.