title: MVC 5 Dropdownlistfor multiselect value binding in edit view
body: <p>I have a select2 multiselect dropdown in edit view. When i try to bind selected values to the dropdown, it fails to bind. Any help appreciated. Please find below code snippets from *.cshtml and *.cs file.</p>
  
  <pre><code>@Html.DropDownListFor(model =&gt; model.Items, new MultiSelectList(ViewBag.ItemsBag, "Value", "Text", Model.ItemsSelected.Select(x =&gt; x.Value)), new { @class = "form-control features-segments select2-multiselect-checkbox", multiple = "multiple" })
  
  ViewBag.ItemsBag = db.Items.Select(v =&gt; new SelectListItem
              {
                  Text = v.ItemName,
                  Value = v.ItemId.ToString()
              });
  
  ModelVM modelVM = new ModelVM()
              {
                  ItemsSelected = SelectedItems.Items.Select(x =&gt; new SelectListItem() { Text = x.ItemName, Value = x.ItemId.ToString() })
              };
  </code></pre>
  
  <p>Items model has below items. The property ItemsSelected is not null and has 3 values in it and ViewBag.ItemsBag is also not null and has all the items from the database. Both of these property are of type SelectListItem with properties Text and Value.</p>
  
  <pre><code>public int FeatureId { get; set; }
  public string FeatureName { get; set; }
  public string ReferenceName { get; set; }
  public FeatureSection SectionName { get; set; }//Enum
  public FeatureType Type { get; set; }//Enum
  public bool DefaultBoolValue { get; set; }
  public string DefaultTextValue { get; set; }
  public IEnumerable&lt;SelectListItem&gt; ItemsSelected { get; set; }
  public virtual ICollection&lt;Item&gt; Items { get; set; } = new List&lt;Item&gt;();
  </code></pre>