dmonlord
dmonlord

Reputation: 1390

CompareAttribute validator?

Validation attributes are realy nice. But what if I have to compare one property to another. How can I implement that?

Scott has a great example for Email attribute validator at http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx but it's bind to only one property.

What if I need to compare one date to another (DateFrom, DateTo), so that DateFrom is before DateTo?

Upvotes: 1

Views: 805

Answers (1)

Matthew Abbott
Matthew Abbott

Reputation: 61599

Check out this SO answer.

Upvotes: 1

Related Questions