title: ViewModel is Null in HttpPost method
body: <p>I'm using ASP.NET MVC 4 and I built these ViewModels : </p>
  
  <pre><code>public class NotificationViewModel
  {
  
      public string GroupDesc { get; set; }
  
      public bool AM { get; set; }
  
      public bool PM { get; set; }
  
      public int MaxNotif { get; set; }
  }
  
  public class SettingsViewModel
  {
      public List&lt;NotificationViewModel&gt; ListNotification { get; set; }
  
      public SettingsViewModel()
      {
          ListNotification = new List&lt;NotificationViewModel&gt;();
      }
  }
  </code></pre>
  
  <p>My View : </p>
  
  <pre><code>@model PortailT2A.Models.SettingsViewModel
  
  @{
      ViewBag.Title = "Preferences";
      Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
  }
  
  &lt;h2&gt;Preferences&lt;/h2&gt;
  
  
  @using(Html.BeginForm("Preferences", "Administrateur", FormMethod.Post))
  {
  
      &lt;table id="settingsTable"&gt;
          &lt;tr&gt;
              &lt;th&gt;Groupe&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
              &lt;th&gt;AM&lt;/th&gt;
              &lt;th&gt;PM&lt;/th&gt;
              &lt;th&gt;Limite de notifications&lt;/th&gt;
          &lt;/tr&gt;
  
      @for (int i = 0; i &lt; Model.ListNotification.Count(); i++ )
      {
          var notif = Model.ListNotification[i];
          &lt;tr&gt;
              &lt;td&gt;@notif.GroupDesc &lt;/td&gt;
              &lt;td&gt;Heure de notification&lt;/td&gt;
              &lt;td&gt;@Html.CheckBoxFor(u =&gt; notif.AM)  &lt;/td&gt;
              &lt;td&gt;@Html.CheckBoxFor(u =&gt; notif.PM)  &lt;/td&gt;
              &lt;td&gt;@Html.TextBoxFor(u =&gt; notif.MaxNotif)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr/&gt;
  
  
      }
  
      &lt;/table&gt;
  
  
      &lt;input type ="submit" value="Sauvegarder" /&gt;
  
  }
  </code></pre>
  
  <p>My HttpGet method populates my ViewModel and returns it. </p>
  
  <pre><code>    [HttpGet]
      public ActionResult Preferences(long idUser)
      {
          context = new MainDatabaseEntities();
  
          List&lt;NotificationViewModel&gt; notifications = new List&lt;NotificationViewModel&gt;();
  
          SettingsViewModel settings = new SettingsViewModel();
  
          //Population...
  
          return View(settings);
      }
  </code></pre>
  
  <p>However, when I want to save the changes, I got a ViewModel which is null and I don't understand why. Any idea guys?</p>
  
  <p><strong>EDIT</strong> : My post method :</p>
  
  <pre><code>            [HttpPost]
              public ActionResult Preferences(SettingsViewModel sm)
              {
                  //since here my ViewModel is null
                  context = new MainDatabaseEntities();
  
                  Utilisateur user = (from u in context.Utilisateurs where u.Username == User.Identity.Name select u).FirstOrDefault();
  
                  //operations...
  
  }
  </code></pre>
  
  <p>HTML generated : </p>
  
  <pre><code>&lt;tr&gt;
          &lt;td&gt;Groupe B &lt;/td&gt;
          &lt;td&gt;Heure de notification&lt;/td&gt;
          &lt;td&gt;&lt;input id="notif_AM" name="notif.AM" type="checkbox" value="true" /&gt;&lt;input name="notif.AM" type="hidden" value="false" /&gt;  &lt;/td&gt;
          &lt;td&gt;&lt;input checked="checked" id="notif_PM" name="notif.PM" type="checkbox" value="true" /&gt;&lt;input name="notif.PM" type="hidden" value="false" /&gt;  &lt;/td&gt;
          &lt;td&gt;&lt;input id="notif_MaxNotif" name="notif.MaxNotif" type="text" value="10" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>