title: How to validate the HTML controls with data annotations in MVC?
body: <p>In .Net MVC. I have a html control. Inorder to bind it with the model property I am using name attribute. How do we get the validations(using data annotation) provided in the model class property  into the html control? </p>
  
  <p>In Cshtml</p>
  
  <pre><code>@using (Html.BeginForm("ClaimWarranty", "WarrentyClaim", FormMethod.Post, new{ enctype = "multipart/form-data" }))
              {
          &lt;div class="form-group row"&gt;
           &lt;label for="" class="col-md-2 col-form-label input-label"&gt;Email Address:&lt;/label&gt;
  
          &lt;div class="col-md-8"&gt;
          &lt;input type="text" name="Emailaddress" class="form-control input-style" placeholder="example@company.com"&gt;
           &lt;/div&gt;
                                              &lt;/div&gt;
          &lt;div class="form-group"&gt;
                      &lt;div class="col-md-offset-2 col-md-10"&gt;
                          &lt;input type="submit" value="Create" onclick="ValidateFileSize()" class="btn btn-default" /&gt;
  
                      &lt;/div&gt;
                  &lt;/div&gt;
          }
  
      //The model class is below;
       public class ClaimWarranty
          {
       [Required(ErrorMessage = "Email ID is Required")]
              [DataType(DataType.EmailAddress)]
              [MaxLength(50)]
              [RegularExpression(@"[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}", ErrorMessage = "Incorrect Email Format")]
              public string Emailaddress { get; set; }
      }
  </code></pre>
  
  <p>I am using the name property to bind the text box to the model property .</p>
  
  <pre><code>&lt;input type="text" name="Emailaddress" class="form-control input-style" placeholder="example@company.com"&gt; 
  </code></pre>
  
  <p>How do I get the validations in the html control ,provided in the model class (using the data annotations) as shown above without using jquery validations or razor code?</p>