title: Model is invalid on post
body: <p>We are trying to pass our ViewModel to our controller using the submit of the form. When the ViewModel arrives at our POST method, it's invalid and null.</p>
  
  <p><strong>VraagViewModel:</strong></p>
  
  <pre><code> public class VraagViewModel
  {
      public List&lt;Thema&gt; Themas { get; set; }
      public List&lt;Gevolg&gt; Condities { get; set; }
      public Vraag Vraag { get; set; }
      public List&lt;Gevolg&gt; GekozenCondities { get; set; }
      public Thema Thema { get; set; }
      public Antwoord Antwoord { get; set; }
  }    
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>    [HttpGet]
      public ActionResult Index()
      {
          UnitOfWorkManager uow = new UnitOfWorkManager();
          IThemaManager mgr = new ThemaManager(uow);
          ITestManager testmgr = new TestManager(uow);
  
          Models.VraagViewModel model = new Models.VraagViewModel
          {
              Themas = mgr.GetThemas().ToList(),
              Condities = testmgr.GetGevolgen().ToList(),
              GekozenCondities = new List&lt;Gevolg&gt;()
          };
          return View(model);
      }
  
      [HttpPost]
      public void Index(Models.VraagViewModel model)
      {
          Debug.WriteLine(model.GekozenCondities.Count); //Nullpointer here!
  
          if (!ModelState.IsValid)
              Debug.WriteLine("ModelState not valid!");                 
      }
  </code></pre>
  
  <p><strong>Index.cshtml:</strong></p>
  
  <pre><code>@model  UI.Mvc.Areas.Admin.Models.VraagViewModel
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;script src="~/Scripts/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;h2&gt;Vraagbeheer&lt;/h2&gt;
  
  @using (Html.BeginForm())
  {
  
  &lt;p&gt;@Html.DropDownList("Themas", new SelectList(Model.Themas))&lt;/p&gt;
  &lt;p&gt;@Html.TextArea("vraag", "Hier komt de vraagtekst")&lt;/p&gt;
  
  
  &lt;p&gt;@Html.ListBox("Condities1", new SelectList(Model.Condities), new { id = 
  "condities1" })&lt;/p&gt;
  &lt;p&gt;@Html.ListBox("Condities2", new SelectList(Model.GekozenCondities), new { 
  id = "condities2" })&lt;/p&gt;
  
  &lt;p&gt;&lt;button type="button" id="add" class="btn btn-default"&gt;Conditie 
  toevoegen&lt;/button&gt;&lt;/p&gt;
  &lt;p&gt;&lt;button type="button" id="remove" class="btn btn-default" 
  onclick="verwijderConditie"&gt;Conditie verwijderen&lt;/button&gt;&lt;/p&gt;
  
  
  @Html.TextArea("antwoord1", "Voor- en nadelen\nAntwoord1")
  @Html.TextArea("antwoord2", "Voor - en nadelen\nAntwoord2")
  @Html.TextArea("antw1Kort", "Antwoord 1")
  @Html.TextArea("antw2Kort", "Antwoord 2")
  &lt;input id="gevolgInvullen" type="submit" value="Gevolgen invullen" 
  class="btn btn-default" /&gt;
  }
  
  @section scripts{
      &lt;script type="text/javascript"&gt;
      $(function () {
          $("#add").bind("click", function (e) {
              $("#condities1 &gt; option:selected").each(function () {
                  $(this).remove().appendTo("#condities2");
              });
              e.preventDefault();
          });
  
          $("#remove").bind("click", function (e) {
              $("#condities2 &gt; option:selected").each(function () {
                  $(this).remove().appendTo("#condities1");
              });
              e.preventDefault();
          });
          /*$("gevolgInvullen").bind("click", function () {
              Url.Action("Action", "Controller")
          })*/
      });
  &lt;/script&gt;
  }
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>We would like to know what causes the ViewModel being null when it arrives in the POST method in our controller.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>It seems that the model itself <a href="https://i.stack.imgur.com/hTR25.png" rel="nofollow noreferrer">is not null.</a></p>