views:

11

answers:

1

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?

A: 

Check out this SO answer.

Matthew Abbott
It sure is an ugly solution, but it's a valid answer, so you get your points :)I think I'm gonna do the validation "the old way"
dmonlord