Need to perform validation on a model’s property based on some other state of the model? Here’s a way to achieve it using the IValidatableObject interface and data annotations.

In our example project we want to validate the state field is a valid Australian state if the country field is “Australia”.

Conditional validation of state field

Read the rest of this entry »