title: Model Validation / ASP.NET MVC 3 - Conditional Required Attribute
body: <p>I'm having trouble with my ASP.NET MVC 3 application. I have 2 propertiesin my model whereby I only want 1 of them required in my view based on whichever one is empty. So for example, if I enter a phone number then email is no longer required and vice versa, but if I leave both empty, then either 1 should be required, below is my model:</p>
  
  <pre><code>[Display(Name = "Contact Phone Number:")]
  [MaxLength(150)]
  public string ContactPhoneNumber { get; set; }
  
  [Display(Name = "Contact Email Address:")]
  [MaxLength(100)]
  public string ContactEmailAddress { get; set; }
  </code></pre>
  
  <p>Would I need to create a custom attribute to validate my model and if so, how would I achieve this? </p>