title: ASP.NET MVC 3 Model has no information on postback
body: <p>I have a view with a couple of partial views that I bind to my model. For some reason, when I post, the model is empty, and I am not sure why.</p>
  
  <p>Below is my ViewModel.</p>
  
  <pre><code>public class IndexViewModel
  {
      public bool AdvancedSearchOption { get; set; }
      public bool ForceAdvanced { get; set; }
      public bool ForceSimple { get; set; }
      public string SimpleSearchCriteria { get; set; }
      public string CustomerNumberCriteria { get; set; }
      public string AccountNumberCriteria { get; set; }
      public string NameCriteria { get; set; }
      public string PhoneNumberCriteria { get; set; }
  }
  </code></pre>
  
  <p>Here is my controller. I am filling in all the values of the viewmodel because I wanted to see if the values got to the partial views. They do get there, so it is just on the post that I am having issues.</p>
  
  <pre><code>public class HomeController : Controller
  {
      private ISecurityRepository SecurityRep;
  
      public HomeController(ISecurityRepository repo)
      {
          SecurityRep = repo;
      }
  
      public ActionResult Index()
      {
          IndexViewModel temp = new IndexViewModel();
          temp.AdvancedSearchOption = SecurityRep.DefaultToAdvancedSearch(User.Identity.Name);
          temp.ForceAdvanced = false;
          temp.ForceSimple = false;
          temp.SimpleSearchCriteria = "Testing";
          temp.AccountNumberCriteria = "Acct";
          temp.CustomerNumberCriteria = "Cust";
          temp.NameCriteria = "Name";
          temp.PhoneNumberCriteria = "Phone";
          return View(temp);
      }
  
      public ActionResult SimpleSearch()
      {
          IndexViewModel temp = new IndexViewModel();
          temp.AdvancedSearchOption = SecurityRep.DefaultToAdvancedSearch(User.Identity.Name);
          temp.ForceAdvanced = false;
          temp.ForceSimple = true;
          temp.SimpleSearchCriteria = "Testing";
          temp.AccountNumberCriteria = "Acct";
          temp.CustomerNumberCriteria = "Cust";
          temp.NameCriteria = "Name";
          temp.PhoneNumberCriteria = "Phone";
          return View("Index",temp);
      }
  
      public ActionResult AdvancedSearch()
      {
          IndexViewModel temp = new IndexViewModel();
          temp.AdvancedSearchOption = SecurityRep.DefaultToAdvancedSearch(User.Identity.Name);
          temp.ForceAdvanced = true;
          temp.ForceSimple = false;
          temp.SimpleSearchCriteria = "Testing";
          temp.AccountNumberCriteria= "Acct";
          temp.CustomerNumberCriteria= "Cust";
          temp.NameCriteria= "Name";
          temp.PhoneNumberCriteria = "Phone";
          return View("Index", temp);
      }
  
      [HttpPost]
      public ActionResult Index(IndexViewModel vm, FormCollection formCollection)
      {
          return View();
      }
  }
  </code></pre>
  
  <p>Here is my view</p>
  
  <pre><code>@model TRIOSoftware.Magnum.Models.IndexViewModel
  
  @{
      ViewBag.Title = "Search";
  }
  
  @if ((@Model.AdvancedSearchOption &amp;&amp; @Model.ForceSimple != true) || @Model.ForceAdvanced == true)
  {
      @Html.Partial("AdvancedSearch")
  }
  else
  {
      @Html.Partial("SimpleSearch")
  }
  </code></pre>
  
  <p>Here is my <code>SimpleSearch</code> partial view. I think if I can get this one working, the other will follow the same path. I do the post in the partial and I use <a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow">jQuery</a> to do it. I am not sure if either of these things could cause me issues or not. I only have all the hidden items in there because I didn't know if not having them was causing my issues.</p>
  
  <pre><code> @model TRIOSoftware.Magnum.Models.IndexViewModel
  
   &lt;script type="text/javascript"&gt;
       $(document).ready(function () {
           $("#DefaultDiv").find("#DefaultAdvanced").click(function () {
               $.post("DefaultSimple");
           });
  
           $("#SearchSection").find("#SearchButton").click(function () {
               $.post("");
           });
       });
  &lt;/script&gt;
  
   @using (Html.BeginForm("Index","Home"))
   {
       @Html.HiddenFor(m =&gt; m.ForceAdvanced)
       @Html.HiddenFor(m =&gt; m.AdvancedSearchOption)
       @Html.HiddenFor(m =&gt; m.ForceSimple)
       @Html.HiddenFor(m =&gt; m.AccountNumberCriteria)
       @Html.HiddenFor(m =&gt; m.CustomerNumberCriteria)
       @Html.HiddenFor(m =&gt; m.NameCriteria)
       @Html.HiddenFor(m =&gt; m.PhoneNumberCriteria)
  
       &lt;div id="DefaultDiv" style="float:right"&gt;
           &lt;a id="DefaultAdvanced" href="#" class="ButtonClass"&gt;Default Simple Search&lt;/a&gt;
       &lt;/div&gt;
  
       &lt;div style="clear:both; margin: auto; width: 800px"&gt;
           &lt;img src="../../Content/images/TRIO_transparent_image.gif"; alt="TRIO Software"; style="margin-left:150px; clear:left"/&gt;
               &lt;div style="clear:left; float: left" class="SearchText"&gt;
                    @Html.Label("What's your inquiry?:")
                    @Html.EditorFor(m =&gt; m.SimpleSearchCriteria, new { style = "width: 400px" })
               &lt;/div&gt;
               &lt;div id="SearchSection" style="float: left" class="SearchText"&gt;
                   &lt;a href="#"; id="SearchButton" class="ButtonClass"&gt;&lt;img src="../../Content/images/Search.gif"; alt="Search"; style="float:left" /&gt;&lt;/a&gt;
               &lt;/div&gt;
               &lt;p style="clear:left;margin-left:400px"&gt;
                   @Html.ActionLink("Advanced Search", "AdvancedSearch", null, new { style = "clear:left" })
               &lt;/p&gt;
  
      &lt;/div&gt;
   }
  </code></pre>
  
  <p>Here is the HTML code when viewing the simple search partial view:</p>
  
  <pre><code>&lt;div id="main"&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
              $("#DefaultDiv").find("#DefaultAdvanced").click(function () {
                  $.post("DefaultSimple");
              });
  
              $("#SearchSection").find("#SearchButton").click(function () {
                  $.post("");
              });
          });
      &lt;/script&gt;
  
      &lt;form method="post" action="/"&gt;
          &lt;input type="hidden" value="False" name="ForceAdvanced" id="ForceAdvanced" data-val-required="The ForceAdvanced field is required." data-val="true"&gt;
          &lt;input type="hidden" value="False" name="AdvancedSearchOption" id="AdvancedSearchOption" data-val-required="The AdvancedSearchOption field is required." data-val="true"&gt;
          &lt;input type="hidden" value="False" name="ForceSimple" id="ForceSimple" data-val-required="The ForceSimple field is required." data-val="true"&gt;
          &lt;input type="hidden" value="Acct" name="AccountNumberCriteria" id="AccountNumberCriteria"&gt;
          &lt;input type="hidden" value="Cust" name="CustomerNumberCriteria" id="CustomerNumberCriteria"&gt;
          &lt;input type="hidden" value="Name" name="NameCriteria" id="NameCriteria"&gt;
          &lt;input type="hidden" value="Phone" name="PhoneNumberCriteria" id="PhoneNumberCriteria"&gt;
          &lt;div style="float:right" id="DefaultDiv"&gt;
              &lt;a class="ButtonClass ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="#" id="DefaultAdvanced" role="button"&gt;&lt;span class="ui-button-text"&gt;Default Simple Search&lt;/span&gt;&lt;/a&gt;
          &lt;/div&gt;
          &lt;div style="clear:both; margin: auto; width: 800px"&gt;
              &lt;img style="margin-left:150px; clear:left" alt="TRIO Software" ;="" src="../../Content/images/TRIO_transparent_image.gif"&gt;
              &lt;div class="SearchText" style="clear:left; float: left"&gt;
                 &lt;label for="What_s_your_inquiry_:"&gt;What's your inquiry?:&lt;/label&gt;
                 &lt;input type="text" value="Testing" name="SimpleSearchCriteria" id="SimpleSearchCriteria" class="text-box single-line"&gt;
              &lt;/div&gt;
              &lt;div class="SearchText" style="float: left" id="SearchSection"&gt;
                  &lt;a class="ButtonClass ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="SearchButton" ;="" href="#" role="button"&gt;&lt;span class="ui-button-text"&gt;&lt;img style="float:left" alt="Search" ;="" src="../../Content/images/Search.gif"&gt;&lt;/span&gt;&lt;/a&gt;
              &lt;/div&gt;
              &lt;p style="clear:left;margin-left:400px"&gt;
                  &lt;a style="clear:left" href="/Home/AdvancedSearch"&gt;Advanced Search&lt;/a&gt;
              &lt;/p&gt;
       &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I fix this problem?</p>