title: how to get all selected checkboxes in razor
body: <p>Working with a checkboxes, and stucked in transfer selected checkboxes to backend. I've an idea how to do this, but I want to hear another variants. So I've a table with checkboxes: </p>
  
  <pre><code>&lt;td&gt;
      &lt;input type="checkbox" class="check" value="@item.Id"/&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>And submit button</p>
  
  <pre><code>@Html.ActionLink("delete", "DeleteSelectedPictures")
  </code></pre>
  
  <p>So my variant is to add bool property and change table from <code>input</code> to <code>@html.checkboxfor(_ =&gt; _.selected)</code>, and how then get these selected items? Is there others way how to solve this problem? </p>
  
  <p>//controller logic</p>
  
  <pre><code>public ActionResult DeleteSelectedPictures(int itemsId)
  {
      var pictures = from items in _Db.Pictures
                     where items.Id == itemsId
                     select items;
  
      foreach (var picture in pictures)
      {
          _Db.Pictures.Remove(picture);
      }
  
      return RedirectToAction("Index");
  }
  </code></pre>
  
  <p><strong>upd 2.</strong></p>
  
  <p>Due to <strong>Ali sultani</strong> suggestion, here is update, but have problem, have null on from here <code>var selected = Request.Form["chkPicture"];</code> </p>
  
  <p>cshtml: </p>
  
  <pre><code> &lt;div&gt;
      @using (Html.BeginForm())
      {
          &lt;table id="images"&gt;
              &lt;tbody&gt;
              @foreach (var item in Model.Pictures.Where(o =&gt; o.PartnerId == Model.PartnerId &amp;&amp; !o.IsDeleted))
              {
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;input name="chkPicture" type="checkbox" class="check" value="@item.Id"/&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;img src="@(Model.BaseUrl)GetPreview.ashx?h=200&amp;id=@item.Id&amp;w=200"/&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              }
              &lt;/tbody&gt;
          &lt;/table&gt;
  
          &lt;div id="container"&gt;
              @Html.ActionLink(R("Remove"), "DeleteSelectedPictures")
          &lt;/div&gt;
  
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>and cs controller:</p>
  
  <pre><code>public ActionResult DeleteSelectedPictures()
      {
          var selected = Request.Form["chkPicture"];
          var selectedList = selected.Split(',');
          foreach (var temp in selectedList)
          {
              var strTemp = Convert.ToInt32(temp);
              var deletePicture = _Db.Pictures.FirstOrDefault(p =&gt; p.Id == strTemp);
              _Db.Pictures.Remove(deletePicture);
              _Db.SaveChanges();
          }
          return RedirectToAction("Index");
      }
  </code></pre>