title: Client-side validation not working from data annotations; server-side does
body: <p>I'm having trouble getting client validation to work on a web form. I'm including .js files and have the relevant lines in web.config, but data validation doesn't get put into the HTML on the client side.</p>
  
  <p>My layout, which is being applied to the page, looks like</p>
  
  <pre><code>&lt;head&gt;
  &lt;title&gt;@ViewBag.Title&lt;/title&gt;
  &lt;link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /&gt;
  
  &lt;script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript" &gt;&lt;/     script&gt;
  &lt;script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript" &gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript" &gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript" &gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/MicrosoftMvcValidation.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>My web.config file has the following:</p>
  
  <pre><code>&lt;appSettings&gt;
  &lt;add key="ClientValidationEnabled" value="true"/&gt;
  &lt;add key="UnobtrusiveJavaScriptEnabled" value="true"/&gt;
  &lt;add key="webpages:Enabled" value="false" /&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>My page's viewmodel has proper annotations and is being validated properly on the server-side</p>
  
  <pre><code>[DisplayName("Url")]
  [DataType(DataType.Url, ErrorMessage = "Invalid Url")]
  [StringLength(30)]
  [Required]
  public string url { get; set; }
  
  [DisplayName("Email")]
  [DataType(DataType.EmailAddress, ErrorMessage = "Invalid Email Address")]
  [Required]
  public string email { get; set; }
  </code></pre>
  
  <p>Finally, I am including the following HTML in my page:</p>
  
  <pre><code>&lt;div class="conLine"&gt;
  @Html.LabelFor(m=&gt; m.url):  @Html.TextBoxFor(m =&gt; m.url) 
  @Html.ValidationMessageFor(m =&gt; m.url)
  &lt;/div&gt;
  &lt;div class="conLine"&gt;
  @Html.LabelFor(m=&gt; m.email):  @Html.TextBoxFor(m =&gt; m.email) 
  @Html.ValidationMessageFor(m =&gt; m.email)
  &lt;/div&gt;
  </code></pre>
  
  <p>The HTML output by the page at this section looks like:</p>
  
  <pre><code>&lt;div class="conLine"&gt;
  &lt;label for="url"&gt;Url&lt;/label&gt;
  : 
  &lt;input class="input-validation-error" id="url" name="url" type="text" value=""/&gt;
  &lt;span class="field-validation-error"&gt;The Url field is required.&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm about at my wit's end with this. Any help would be greatly appreciated!</p>