This article shows how you can use ValidationAttribute class for custom validation based on your requirement.