title: ASP.NET MVC PartialView postback: how to validate data?
body: <p>I am using ASP.NET partial views like in this example</p>
  
  <pre><code>&lt;% using (Html.BeginForm()) { %&gt;
      &lt;table cellspacing="2" cellpadding="0" border="0" width="100%"&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= Html.LabelFor(model =&gt; model.PersonName)%&gt;&lt;/td&gt;
          &lt;td&gt;
              &lt;%= Html.TextBoxFor(model =&gt; model.PersonName)%&gt;
              &lt;%= Html.ValidationMessageFor(model =&gt; model.PersonName, "*")%&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      ...
      &lt;tr&gt;&lt;td colspan="2"&gt;&lt;%= Html.ValidationSummary(false) %&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>I show these partial views in Jquery dialogs calling them using jquery code</p>
  
  <pre><code>$.ajax({
      type: "get",
      dataType: "html",
      url: urlAction,
      data: {},
      success: function(response) {
          $("#panelDetail").html('').html(response).dialog('open');
      }
  });
  </code></pre>
  
  <p>and everything works and make me happy. I am also able to submit the form using jquery ajax and this make me even more happy. :)</p>
  
  <p>What is really annoying is that I did not understand where validation occurs because, when it happens, it does a full refresh of the page and close the dialog.</p>
  
  <p>I am sure that somebody can help on this. Anyway....who will be? :)</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>This is the controller action signature with some code in it</p>
  
  <pre><code>[HttpPost]
  public ActionResult MyAction(FormCollection form) {
      string foroID = form["ForoId"];
      string foro = form["Foro"];
      string authorityId = form["AuthorityId"];
      string sezione = form["Sezione"];
      ...
  }
  </code></pre>
  
  <p>Do I have to re-create the model class to validate it? </p>