title: How to validate multiple data annotations and return one error message in view
body: <p>I am using data annotations with MVC2 to validate a date of birth. The date of birth has 3 different fields. (Month, Day and Year) <em>(they have to be three individual fields)</em></p>
  
  <p>Right now I have individual data annotations for each field. How can I make it so that all three fields are validated and show one error message in my view. The setup I have right now creates an error message for each field. </p>
  
  <p>If any one of those fields throws an error, I want to show a generic error message like <code>"Date of Birth invalid"</code>.</p>
  
  <p>Month Field:</p>
  
  <pre><code>        [Required]
          [DisplayName("Month")]
          public IEnumerable&lt;string&gt; Months 
          { 
              get 
              {
                  if (_Months == null)
                  {
                      List&lt;string&gt; months = new List&lt;string&gt;();
                      months.Add("-- Select Month --");
                      months.AddRange(DateTimeFormatInfo.CurrentInfo.MonthNames.Select(Month =&gt; Month).ToList());
                      months.RemoveAt(months.Count - 1);
                      _Months = months;
                  }
                  return _Months;
              }
              set { _Months = value; }
          }
  
          private IEnumerable&lt;string&gt; _Months;
  
          public string SelectedMonth {get; set;}
  </code></pre>
  
  <p>Day Field:    </p>
  
  <pre><code>    [Required]
      [DisplayName("Day")]
      [Range(1,31, ErrorMessage = "Not a valid day")]
      public int? Day { get; set; }
  </code></pre>
  
  <p>Year Field:    </p>
  
  <pre><code>    [Required]
      [DisplayName("Year")]
      [Range(1900,9999, ErrorMessage = "Not a valid year")]
      [ValidateBirthYear]
      public int? Year { get; set; } 
  </code></pre>