title: asp.net repeater and jQuery datables paging and check boxes not working
body: <p>I'm using jquery datatables plugin along with asp.net repeater.  I but a check box in the first column of the repeater to allow a user to check which record they would like to save to the database.  I have the repeater, jquery plugin with paging working 100%.  The problem that I can't seam to resolve is that when I check a box on multiple page and hit submit, I'm only able to get the current page check box because all of the other checked boxes become unchecked.</p>
  
  <p>.net Markup</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var oTable;
  $(document).ready(function () {
  
      oTable = $('#tblList').dataTable({
          "bJQueryUI": true,
          "sPaginationType": "full_numbers",
          "bServerSide": false,
          "iDisplayLength": 7,
          "aaSorting": [[1, "asc"]],
          "bFilter": true,
          "bLengthChange": false,
          "aoColumns": [
          /* other columns */null, null, null, null],
          "sDom": 'T&lt;"toolbar"&gt;lrtip'
      });
  });
  &lt;/script&gt;
  &lt;asp:Panel ID="pnlPages" runat="server" Visible="false"&gt;
  &lt;asp:Repeater ID="rptList" runat="server" OnItemDataBound="RptList_ItemDataBound"&gt;
          &lt;HeaderTemplate&gt;
              &lt;table id="tblList" cellpadding="0" cellspacing="0" border="0" class="display"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;                                
                          &lt;th&gt;&lt;/th&gt;                                
                          &lt;th&gt;Name&lt;/th&gt;                                        
                          &lt;th&gt;Status&lt;/th&gt;                            
                          &lt;th&gt;Modified&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
              &lt;tbody&gt;
          &lt;/HeaderTemplate&gt;
          &lt;ItemTemplate&gt;
                  &lt;tr&gt;
                      &lt;asp:HiddenField ID="hdnID" runat="server" Value='&lt;%# Eval("ID") %&gt;' /&gt;
                      &lt;td style="width: 5%"&gt;&lt;asp:CheckBox ID="chkSelected" runat="server" OnCheckedChanged="Save_OnChecked" AutoPostBack="true" value='&lt;%# Eval("ID") %&gt;' /&gt;&lt;/td&gt;
                      &lt;td style="width: 47%"&gt;&lt;%# Eval("Name")%&gt;&lt;/td&gt;
                      &lt;td style="width: 7%"&gt;&lt;%# Eval("Status") %&gt;&lt;/td&gt;
                      &lt;td style="width: 25%"&gt;&lt;%# ((DateTime)Eval("DateModified")).ToShortDateString() %&gt;&lt;/td&gt;
                  &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
          &lt;FooterTemplate&gt;
              &lt;/tbody&gt; 
          &lt;/table&gt;
          &lt;/FooterTemplate&gt;
      &lt;/asp:Repeater&gt;
      &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>On page load I call the following method and provide the list</p>
  
  <pre><code>public void DisplayList(List&lt;MyPages&gt; list)
      {
          rptList.DataSource = list;
          rptList.DataBind();
          pnlPages.Visible = true;
      }
  </code></pre>
  
  <p>This this method checks the boxes from the database</p>
  
  <pre><code>protected void RptList_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
      {
          string groupID = !string.IsNullOrEmpty(Request.QueryString["id"]) ? Request.QueryString["id"] : string.Empty;
          if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
          {
              HiddenField pageID = (HiddenField)e.Item.FindControl("hdnID");
              GroupPage groupPage = groupsPresenter.GetByKeys(new Guid(groupID), new Guid(pageID.Value));
  
              if (groupPage != null)
              {
                  CheckBox chk = (CheckBox)e.Item.FindControl("chkSelected");
                  chk.Checked = true;
              }
          }
      }
  </code></pre>
  
  <p>All of the above code works.  Here is where it stops working.  When a user checks a box the following code is executed.</p>
  
  <pre><code>protected void Save_OnChecked(object sender, EventArgs e)
      {
          CheckBox chk = (CheckBox)sender;
          string id = chk.Attributes["value"].ToString();
      }
  </code></pre>
  
  <p>I noticed when debugging if I have 4 rows checked on the 1st page and I go to the 2nd page and uncheck a box the Save_OnChecked event is called and all of the check boxes on the home page become unchecked. so the Save_OnChecked is called 5 times total.  </p>
  
  <p>If I did not use the datatables paging and all of the records where on the first page it works just fine.  Hopefully this makes sense and I hope someone can help me.</p>