title: How do I use server side validation with an AJAX post?
body: <p>In his blog post, Scott Guthrie describes how to <a href="http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx" rel="nofollow noreferrer">enable validation using DataAnnotations</a>.</p>
  
  <p>Example:</p>
  
  <pre><code>public class Product
  {
      [Display(Name="Product Number")]
      [Range(0, 5000)]
      public int ProductID { get; set; }
  
      [Display(Name="Name")]
      [Required]
      public string ProductName { get; set; }
  
      [Display(Name="Price")]
      [DataType(DataType.Currency)]
      public double ListPrice { get; set; }
  }
  </code></pre>
  
  <p>In the comments to this blog post @Ke wrote:</p>
  
  <blockquote>
    <p>How do the server side validations work with ajax post? i.e, how can i send the validation errors back to the client?</p>
  </blockquote>
  
  <p>Scott replied with:</p>
  
  <blockquote>
    <p>Yes - you can handle this.  I believe Phil Haack has it on his list to blog about soon.</p>
  </blockquote>
  
  <p>I cannot find this blog post though.  How do I combine server-side validation with an AJAX post?  </p>
  
  <p>The best options I've seen seem to involve using partials to send the form back to the client.  I would rather use client-side Javascript to enable the error messages.</p>