title: Get selected values of a ListBox
body: <p>Model:</p>
  
  <pre><code>public virtual ICollection&lt;Product&gt; OriginalProducts { get; set; }
  public virtual ICollection&lt;Product&gt; SimilarProducts { get; set; }
  </code></pre>
  
  <p>View (Create and Edit are equal):</p>
  
  <pre><code>&lt;div id="divSimilar" class="form-group"&gt;
      @Html.Label("Similar Products", htmlAttributes: new { @class = "control-label col-md-2" })
      &lt;div class="col-md-10"&gt;
          @Html.ListBox("Products", null, htmlAttributes: new { @class = "form-control" })
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Create([Bind(Include = "MyAttributes")] Product product)
  {
      if (ModelState.IsValid)
      {
          db.Products.Add(product);
          List&lt;string&gt; selectedSimilars = Request.Form.GetValues("Products").ToList();
  
          foreach (string Id in selectedSimilars)
          {
              Product similarProd = db.Products.Find(System.Convert.ToInt32(Id));
              if (similarProd != null)
                  product.SimilarProducts.Add(similarProd);
          }
  
          db.SaveChanges();
          return RedirectToAction("Index").Success("Successfully created");
      }
  
      ViewBag.Products = new SelectList(db.Products, "Id", "Name", product.SimilarProducts);
      return View(product);
  }
  
  public ActionResult Edit(int? id)
  {
      if (id == null)
      {
          return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
      }
      Product product = db.Products.Find(id);
      if (product == null)
      {
          return HttpNotFound();
      }
      ViewBag.Products = new SelectList(db.Products.Where(p =&gt; p.Id != product.Id), "Id", "Name", product.SimilarProducts);
      return View(product);
  }
  </code></pre>
  
  <p>So, since "Create" part is working fine, I want to know how can I make to get all selected SimilarProducts (that I added in "Create") in my "Edit" view. What changes are necessary in controller to make it work?</p>
  
  <p>Btw, since I'm using the ListBox, I think there's a different way of the DropDownList, because I used this way for all my DropDownLists and are working fine.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I want to display in "Edit" view, all products (that were selected when I created that product) in blue. In other words, the ActionResult "Edit" should get all selected products from the SimilarProducts list, as in the DropDownList.</p>