title: How to use DataAnnotations attributes with jquery validation?
body: <p>I am trying to validate MVC 4 form with jquery, but I want to get data annotations 
  attributes for do it.</p>
  
  <p>My model:</p>
  
  <pre><code>    [Required(AllowEmptyStrings = false,ErrorMessage = "Username is required")]
      [Display(ResourceType = typeof(EntitiesResources), Name = "Username")]
      string Username { get; set; }
  
      [Display(ResourceType = typeof(EntitiesResources), Name = "Password")]
      [Required(AllowEmptyStrings = false)]
      string Password { get; set; }
  
      [Display(ResourceType = typeof(EntitiesResources), Name = "Email")]
      [DataType(DataType.EmailAddress)]
      string Email { get; set; }
  </code></pre>
  
  <p>My MVC view:</p>
  
  <pre><code>&lt;div class="row form-group"&gt;
  &lt;div class="col-xs-2 col-sd-2 col-md-2 col-lg-2"&gt;@Html.LabelFor(m =&gt; m.FirstName)&lt;/div&gt;
  &lt;div class="col-xs-4 col-sd-4 col-md-4 col-lg-4"&gt;@Html.TextBoxFor(m =&gt; m.FirstName, new { required = "required" })&lt;/div&gt;
  
  
  &lt;div class="col-xs-2 col-sd-2 col-md-2 col-lg-2"&gt;@Html.LabelFor(m =&gt; m.Email)&lt;/div&gt;
  &lt;div class="col-xs-4 col-sd-4 col-md-4 col-lg-4"&gt;@Html.TextBoxFor(m =&gt; m.Email, new { required = "required" })&lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>My problem is that if I don´t put that 'required' attribute in MVC view, it doesn´t work ($("#UserForm").valid() returns always true). And I would like to use email validation too.</p>
  
  <p>I call jquery validation on Ajax call:</p>
  
  <pre><code>$("#UserForm").validate();
  if ($("#UserForm").valid()) {
      var model = {
          Id: $("#Id").val(),
          FirstName: $("#FirstName").val(),
          Email: $("#Email").val(),
          LastName: $("#LastName").val(),
          Enabled: $("#Enabled").val(),
          Username: $("#Username").val(),
          Password: $("#Password").val(),
      }
      $.ajax({
          url: "SaveUser/Users",
          type: "Post",
          contentType: 'application/json',
          dataType: "json",
          data: JSON.stringify(model),
          success: function (data) {
              alert(data.Message);
              returnUsersGrid();
          },
          error: function (e) {
  
          },
          complete: function () {
  
          }
      });
  }
  </code></pre>
  
  <p>Is there anyway to use data annotations with razor helpers and jquery validation, or data annotations only works with the server side validation with ModelState.isvalid()?</p>