Validation attributes are realy nice. But what if I have to compare one proper开发者_运维问答ty 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?
Check out this SO answer.
精彩评论