title: ASP.NET MVC 5 ViewModel binding with Dictionary of List of ViewModels sends null values
body: <p>I have some "advanced" ViewModel I cannot handle properly. After posting the form there are <strong>keys</strong> in controller's action parameters, by <strong>values</strong> are nulls. I tried everything I found and everytime it had nulls, If you need more informations just write and I'll provide them.<br>
  I'm using jQuery's select2 plugin for my select inputs.</p>
  
  <p>ParentViewModel:</p>
  
  <pre><code>public class ParentViewModel
  {
      public IList&lt;string&gt; ParentValues { get; set; }
      public IDictionary&lt;string, IList&lt;ChildViewModel&gt;&gt; ChildDictionary { get; set; }
  }
  </code></pre>
  
  <p>ChildViewModel:</p>
  
  <pre><code>public class ChildViewModel
  {
      public string Id { get; set; }
      public IList&lt;string&gt; ChildValues { get; set; }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@foreach (KeyValuePair&lt;string, IList&lt;ChildViewModel&gt;&gt; child in Model.ChildDictionary)
  {
      &lt;table&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;td&gt;Id&lt;/td&gt;
                  &lt;td&gt;Values&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
          @for (var i = 0; i &lt; child.Value.Count; i++)
          {
          &lt;tr&gt;
              &lt;td&gt;@child.Value[i].Id&lt;/td&gt;
              &lt;td&gt;
                  @Html.HiddenFor(m =&gt; child.Value[i].Id)
                  // Here i tried manual binding
                  &lt;select multiple="multiple" name="Model.ChildDictionary[@child.Key].Value[@i].ChildValues"&gt;
                  @for (var r = 0; r &lt; Model.ParentValues.Count; r++)
                  {
                      &lt;option @(child.Value[i].ChildValues.Contains(Model.ParentValues[r]) ? "selected" : "") value="@Model.ParentValues[r]"&gt;
                          @Model.ParentValues[r]
                      &lt;/option&gt;
                  }
                  &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          }
      &lt;/tbody&gt;
      &lt;/table&gt;
  }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  Ok, if dictionary is bad, maybe you have an idea.<br>
  I got a List of that type of data:</p>
  
  <p>ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| VALUES<br>
  Base1-subbase1-foo | foo, bar<br>
  Base1-subbase2-foo | foo<br>
  Base2-subbase1-foo | foo, bar<br>
  Base2-subbase2-foo | foo, bar<br>
  Base3-subbase1-foo | bar  </p>
  
  <p>and I need to group them by the "Base*" id value</p>