title: How do you do web forms model validation?
body: <p>We have an application with three layers: UI, Business, and Data. The data layer houses Entity Framework v4 and auto-generates our entity objects. I have created a buddy class for the entity <code>VendorInfo</code>:</p>
  
  <pre><code>namespace Company.DataAccess
  {
      [MetadataType(typeof(VendorInfoMetadata))]
      public partial class VendorInfo
      {
      }
  
      public class VendorInfoMetadata
      {
          [Required]
          public string Title;
  
          [Required]
          public string Link;
  
          [Required]
          public string LinkText;
  
          [Required]
          public string Description;
      }
  }
  </code></pre>
  
  <p>I want this validation to bubble up to the UI, including custom validation messages assigned to them. In MVC this is a piece of cake but in web forms I have no clue where to begin. What is the best way to utilize model validation in asp.net web forms?</p>
  
  <p>I did find <a href="http://www.codeproject.com/KB/validation/Data_Annotations_with_ASP.aspx?msg=3603632&amp;display=Mobile" rel="nofollow">an article</a> that explains how to build a server control for it, but I can't seem to get it working. It compiles and even recognizes the control but I can never get it to fire.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks everyone.</p>