title: MVC View is not displaying Model Properties on the Page
body: <p>Please be patient with me while I try to explain my issue.</p>
  
  <p>I'm Posting My Form Back to Controller and updating the model and passing it back into the view.  This works correctly if I use a submit button, but not if I use a non-submit button and try to post back with javascript.</p>
  
  <p>I've tried looking for this issue, but I'm not sure how to word it so I can get any results close to it.</p>
  
  <p>Basically</p>
  
  <ol>
  <li><p>CORRECT - when I click the AddDetail button which is input type="submit", my controller gets called and the model gets updated and passed back to the view and the elements are correctly displayed on the page.</p></li>
  <li><p>INCORRECT - when I click the AddDetail1 button which is input type="button", my javascript is called when the button is clicked, the controller method is called, the FormCollection and Model is passed into the controller correctly.  The Model gets updated and passed back to the view, but none of the elements are being displayed on the page.</p></li>
  </ol>
  
  <p>I've stepped through this code 100 times and everything I see is exactly the same right down to the elements being set in the view.  The only difference is the Submit Button will render the controls, but the Other Button won't render anything.  I've viewed the html source after hitting each button and the Submit Button shows the controls, but there are no Controls when I click the Other Button.</p>
  
  <p>I've even added an @Model.cases.count on the page - Initially it shows 0 which is correct, but after post back it shows 1 for the submit button and when I step through the code for the other button, it shows 1, but when the page is finally finished and everything is rendered, it shows 0 even though it was 1 when I was stepping through the code.  </p>
  
  <p>Very Frustrating</p>
  
  <p>Any Ideas would be greatly appreciated.</p>
  
  <p>Here's my simplified view</p>
  
  <pre><code>@model CASA.ViewModels.CaseViewModel
  
  &lt;script type="text/javascript"&gt;
      $(function () {
          $("#AddDetail1").click(function () {
              var form = $(':input');
              //var action = form.attr("action");
              var serializedForm = form.serialize();
              var url = '@Url.Action("CreateCase")';
              //$.post(url, serializedForm);
              $.ajax({
                  url: url,
                  data: serializedForm,
                  type: 'POST',
                  success: function (response) {
                      alert(response);
                      // process the results from the controller action
  
                      //  window.location.href = response.Url;
                  }
  
              });
          });
      });
  @using (Html.BeginForm())
  {
      @Html.ValidationSummary(true)
  
      @if (Model.cases != null &amp;&amp; Model.cases.Count &gt; 0)
          {
              for (int i = 0; i &lt; Model.cases.Count; i++)
              {
                  &lt;tr&gt;
                      &lt;td&gt;
                          @Html.TextBoxFor(m =&gt; m.cases[i].CaseNumber, new { @class = "textbox" })
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.TextBoxFor(m =&gt; m.cases[i].FirstName, new { @class = "nameTextbox" })
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.TextBoxFor(m =&gt; m.cases[i].LastName, new { @class = "nameTextbox" })
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.EditorFor(m =&gt; m.cases[i].DOB)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.RadioButtonListFor(m =&gt; m.cases[i].Sex, Model.radiobuttons.RadioButtonListItems)
                      &lt;/td&gt;
                  &lt;/tr&gt;
              }
          }
  
  &lt;input type="submit" value="+" id="AddDetail" class="button" /&gt;
  &lt;input type="button" value="+" id="AddDetail1" class="button" /&gt;
  }
  </code></pre>
  
  <p>Here's My Controller:</p>
  
  <pre><code>[HttpPost]
          public ActionResult CreateCase(FormCollection collection, CaseViewModel model)
          {
              if (ModelState.IsValid)
              {
                  model.cases.Add(new CASA_Cases
                  {
                      CaseNumber = collection["CaseNumber"],
                      FirstName = collection["FirstName"],
                      LastName = collection["LastName"],
                      DOB = Convert.ToDateTime(collection["DOB"]),
                      Sex = collection["Sex"]
                  });
  
                  UpdateModel(model);
                  if (submit.Count() &gt; 0)
                  {
                      model.cases.ForEach(item =&gt;
                          {
                              if (model.group.ID == null)
                              {
                                  model.group.ID = Guid.NewGuid();
                                  model.group.UserID = Utilities.Utilities.GetUserID;
                              }
  
                              item.CASA_CaseGroups_ID = model.group.ID;
                          });
                  }
              }
              return View(model);
          }
  </code></pre>