title: Set focus on on ASP.NET MVC model errors
body: <p>I've got a model that does some validation checking and adds the errors to ModelState:</p>
  
  <pre><code>ViewData.ModelState.AddModelError("mycontrol", "message")
  </code></pre>
  
  <p>They display fine on the view side, but is there a way to set the focus to the control that corresponds to the validation message? Right now, the page refreshes and stays at the top of the page, so if the error is towards the end of the page, it's not obvious to the user what happened.</p>
  
  <p>Note: Another solution would be for ValidationSummary to show the list of errors at the top of the page, but I've never been able to get it to display anything. All my errors are displayed via ValidationMessage.</p>
  
  <p><strong>Edit:</strong> I found my problem with ValidationSummary. The markup I had was:</p>
  
  <pre><code>&lt;% Html.ValidationSummary()%&gt;
  </code></pre>
  
  <p>which should have been:</p>
  
  <pre><code>&lt;%=Html.ValidationSummary()%&gt;
  </code></pre>
  
  <p>I'd still like to know how to snap to the field with the error however.</p>