title: Submit checkboxes value from all pages from jQuery DataTables to the controller
body: <p>I am trying to pass the value of all select checkbox to the controller. when i run the code I am having the error below and not all checkbox value are passed to the controller</p>
  
  <p>"Uncaught TypeError: Cannot read property 'selected' of undefined"</p>
  
  <p>Please can anyone tell me where I am going wrong</p>
  
  <p>View Code</p>
  
  <pre><code>&lt;table id="tblBulckTicket" class="table table-condensed table-striped table-hover datatable responsive" &gt;
   &lt;thead&gt;
    &lt;tr&gt;
       &lt;th&gt;
       &lt;/th&gt;
       &lt;th&gt;
          @Html.Label("id", "Ticket ID")
       &lt;/th&gt;
       &lt;th&gt;
          @Html.Label("subject", "Subject")
       &lt;th&gt;
          @Html.Label("StageName", "Status")
       &lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
    &lt;tbody&gt;
    @foreach (var item in Model)
    {
    &lt;tr&gt;
       &lt;td&gt;
          &lt;input type="checkbox" name="TicketId" id="TicketId" value="@item.Id"&gt;                                  
       &lt;/td&gt;
       &lt;td&gt;
          &lt;a class="pull-left btn btn-primary btn-xs" href="@Url.Action("Ticket", "Home" , new { id=item.Id})"&gt;
          &lt;i class="fas fa-hashtag"&gt;&lt;/i&gt;
          @Html.DisplayFor(modelItem =&gt; item.Id) &lt;/a&gt;
       &lt;/td&gt;
       &lt;td&gt;
          @Html.DisplayFor(modelItem =&gt; item.Subject)
       &lt;/td&gt;
       &lt;td&gt;
          @Html.DisplayFor(modelItem =&gt; item.StageName)
       &lt;/td&gt;
    &lt;/tr&gt;
    }
  </code></pre>
  
  <p>
  </p>
  
  <p>Javascript code</p>
  
  <pre><code>    $(document).ready(function () {
          var table =   $('#tblBulckTicket').DataTable({
              "pageLength": 5
          });
  
          // Handle form submission event 
          $('#formId').on('submit', function (e) {
              var form = this;
              var rows_selected = table.column(0).checkboxes.selected();
              // Iterate over all selected checkboxes
              $.each(rows_selected, function (index, rowId) {
                  // Create a hidden element 
                  $(form).append(
                      $('&lt;input&gt;')
                          .attr('type', 'hidden')
                          .attr('name', 'TicketId[]')
                          .val(rowId)
                  );
              });
                e.preventDefault();
          });  
         }); 
  </code></pre>