title: ASP.NET MVC After Post Back List that contains List property in ViewModel is null
body: <p>As I mentioned in title after Post Back List (MySalonTreatments) property in ViewModel is null.</p>
  
  <p>I am new to MVC but I think it should work. Model binder know how to handle complex types.
  I search a lot but I do not get on any solution. Maybe you could point me errors.</p>
  
  <p>ViewModel:</p>
  
  <pre><code>public class CreateSalonViewModel
  {
      public string Name { get; set; }
  
      [DataType(DataType.EmailAddress)]
      public string EmailAddress { get; set; }
  
      //it shouldn't be facebook adress
      public string Website { get; set; }
  
      public string MobilePhone { get; set; }
  
      public string LandlinePhone { get; set; }
  
      public int CityId { get; set; }
  
      public int ProvinceId { get; set; }
  
      public List&lt;SalonTreatments&gt; MySalonTreatments;
  }
  
  public class SalonTreatments
  {
      public List&lt;Treatment&gt; SpecTypeTreaments { get; set; }
      public TreatmentType TreatmentType { get; set; }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public class SalonController : Controller
  {
      private CrsDatabase db = new CrsDatabase();
  
      //
      // GET: /Salon/Create
      [Authorize]
      [HttpGet]
      public ActionResult Create()
      {
          return View(GetCreateSalonViewModel());
      }
  
      [Authorize]
      [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Create(CreateSalonViewModel createSalonViewModel)
      {
          return View(createSalonViewModel);
      }
  
      #region service methods
  
      private CreateSalonViewModel GetCreateSalonViewModel()
      {
          CreateSalonViewModel createSalonViewModel = new CreateSalonViewModel();
          createSalonViewModel.MySalonTreatments = new List&lt;SalonTreatments&gt;();
  
          foreach (var treatmentType in db.TreatmentType)
          {
              var treatmentOfSpecType = db.Treatment.Where(t =&gt; t.TreatmentType.Id == treatmentType.Id).ToList();
              if (treatmentOfSpecType.Count &gt; 0)
              {
                  SalonTreatments salonTreatments = new SalonTreatments();
                  salonTreatments.TreatmentType = treatmentType;
                  salonTreatments.SpecTypeTreaments = treatmentOfSpecType;
  
                  createSalonViewModel.MySalonTreatments.Add(salonTreatments);
              }
          }
  
          return createSalonViewModel;
      }
  
      #endregion
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@model CRSWebsite.ViewModels.CreateSalonViewModel
  
  @using (Html.BeginForm("Create", "Salon", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
  {
      @Html.AntiForgeryToken()
  
      &lt;div class="form-horizontal"&gt;
          &lt;h4&gt;CreateSalonViewModel&lt;/h4&gt;
          &lt;hr /&gt;
          @Html.ValidationSummary(true)
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.Name)
                  @Html.ValidationMessageFor(model =&gt; model.Name)
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.EmailAddress, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.EmailAddress)
                  @Html.ValidationMessageFor(model =&gt; model.EmailAddress)
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Website, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.Website)
                  @Html.ValidationMessageFor(model =&gt; model.Website)
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.MobilePhone, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.MobilePhone)
                  @Html.ValidationMessageFor(model =&gt; model.MobilePhone)
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.LandlinePhone, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.LandlinePhone)
                  @Html.ValidationMessageFor(model =&gt; model.LandlinePhone)
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.CityId, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.CityId)
                  @Html.ValidationMessageFor(model =&gt; model.CityId)
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.ProvinceId, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.ProvinceId)
                  @Html.ValidationMessageFor(model =&gt; model.ProvinceId)
              &lt;/div&gt;
          &lt;/div&gt;
  
          @for (int i = 0; i &lt; Model.MySalonTreatments.Count; i++)
          {
              &lt;label&gt;Zabiegi @Model.MySalonTreatments[i].TreatmentType.Name:&lt;/label&gt;
              &lt;div class="form-group"&gt;
                  &lt;div class="col-md-10"&gt;
                      @for (int j = 0; j &lt; Model.MySalonTreatments[i].SpecTypeTreaments.Count; j++)
                      {
                          @Html.CheckBoxFor(m =&gt; m.MySalonTreatments[i].SpecTypeTreaments[j].IsSelected)
                          @Html.DisplayFor(m =&gt; m.MySalonTreatments[i].SpecTypeTreaments[j].Name)
                      }
                  &lt;/div&gt;
              &lt;/div&gt;
          }
          &lt;div class="form-group"&gt;
              &lt;div class="col-md-offset-2 col-md-10"&gt;
                  &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>Regards,
  Peter</p>