title: Get Multiple Selected checkboxes in MVC
body: <p>i have a ProductController which is consists of Create method. </p>
  
  <p>My Model :</p>
  
  <pre><code>public class ProductEntry
  {
      public Crescent.LinqModel.Product Products { get; set; }
      public ProductSKU SKUs { get; set; }
      public List&lt;SelectListItem&gt; pColors { get; set; }
  
      public ProductEntry()
      {
          pColors = new List&lt;SelectListItem&gt;();
      }
  }
  </code></pre>
  
  <p>Create Get Method :</p>
  
  <pre><code>    public ActionResult Create()
      {
          CrescentAdmin.Models.ProductEntry product = new CrescentAdmin.Models.ProductEntry();
          var colors = _appData.GetProductColors().ToList();
          for (int i = 0; i &lt; colors.Count; i++)
          {
              if (i == 0)
                  product.pColors.Add(new SelectListItem { Value = colors[i].Name.ToString(), Text = colors[i].Name, Selected = true });
              else
                  product.pColors.Add(new SelectListItem { Value = colors[i].Name.ToString(), Text = colors[i].Name });
          }
  
          return View(product);
      }
  </code></pre>
  
  <p>this colors i want to fill in the list of checkboxes in which i can select multiple checkboxes.its working properly.</p>
  
  <p>Create Post :</p>
  
  <pre><code>    [HttpPost]
      [ValidateInput(false)]
      public ActionResult Create(CrescentAdmin.Models.ProductEntry entry, HttpPostedFileBase uploadFile)
      {
        //code to insert in two table
        // required to fetch which checkboxes are selected ??    
      }
  </code></pre>
  
  <p>Create View :</p>
  
  <pre><code>       @model CrescentAdmin.Models.ProductEntry
  </code></pre>
  
  <p>code to fill list of checkboxes :</p>
  
  <pre><code>         &lt;tr&gt;
              &lt;td&gt;
                  Product Colors
              &lt;/td&gt;
              &lt;td&gt;
                  @if (Model.pColors != null &amp;&amp; Model.pColors.Count &gt; 0)
                  {
                      for (int i = 0; i &lt; Model.pColors.Count; i++)
                      {
                          //if (Model.pColors[i])
                          //{
                              &lt;input type="checkbox" value="@Model.pColors[i].Value" id="@Model.pColors[i].Value"/&gt; @Model.pColors[i].Text &lt;br /&gt;
                               @Html.HiddenFor(m =&gt; Model.pColors[i].Value);
                               @Html.HiddenFor(m =&gt; Model.pColors[i].Text);
                               @Html.HiddenFor(m =&gt; Model.pColors[i].Selected);
                          //}
                          //else
                          //{
                          //    &lt;input type="checkbox" value="@Model.pColors[i].Value" /&gt; @Model.productColors[i].Name &lt;br /&gt;
                          //}
                      }
                  }
  
  
                  @Html.ValidationMessageFor(model =&gt; model.SKUs.ProductColors)
              &lt;/td&gt;
          &lt;/tr&gt;
  </code></pre>
  
  <p>i have tried this code , but no luck !!</p>
  
  <p>required to fetch which checkboxes are selected ??   Please help </p>