title: Select All checkbox not firing back end code
body: <p>I have added a select all checkbox to my page and coded the logic for it with JQuery:</p>
  
  <pre><code>&lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"&gt;
  &lt;/script&gt;
  &lt;script&gt;
      $(document).ready(function () {
  
          var chkAll = $("#&lt;%= chkSelectAll.ClientID %&gt;");
  
          var domCheckbox1 = chkAll[0];
          if (typeof domCheckbox1 !== "undefined") { var isChecked = domCheckbox1.checked; }
  
  
          if (isChecked == true) {
              $("#&lt;%= GVAccounts.ClientID %&gt;").find("[type='checkbox']").prop('checked', true);
          }
          else{
              $("#&lt;%= GVAccounts.ClientID %&gt;").find("[type='checkbox']").prop('checked', false);
          }
      }); 
  &lt;/script&gt;
  </code></pre>
  
  <p>The select all code checks off all of the checkboxes within my gridview's child grid (chkSelect in the below code):</p>
  
  <pre><code>    &lt;asp:Label ID="lblSelectAll" runat="server" Text="Select All : "&gt;&lt;/asp:Label&gt;
      &lt;asp:CheckBox ID="chkSelectAll" runat="server" AutoPostBack="true" /&gt;
      &lt;asp:GridView ID="GVAccounts" runat="server" AutoGenerateColumns="False" 
          CellPadding="4" ForeColor="#333333"
          GridLines="Horizontal"
          style="position: relative; margin-top: 10px;"&gt;
          &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="branch" HeaderText="Branch" 
                  SortExpression="branch" /&gt;
              &lt;asp:BoundField DataField="no" HeaderText="Account" 
                  SortExpression="account" /&gt;
              &lt;asp:TemplateField HeaderText="Name" SortExpression="name"&gt;
                  &lt;EditItemTemplate&gt;
                      &lt;asp:TextBox ID="TextName" runat="server" Text='&lt;%# Eval("name") %&gt;'&gt;&lt;/asp:TextBox&gt;
                  &lt;/EditItemTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="LabelName" runat="server" Text='&lt;%# Eval("name") + " " + Eval("surname") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
              &lt;asp:BoundField DataField="type" HeaderText="Type" SortExpression="type" /&gt;
              &lt;asp:BoundField DataField="sub" HeaderText="Sub" SortExpression="sub" /&gt;
              &lt;asp:BoundField DataField="TotalAmount" HeaderText="Hold"
                  SortExpression="TotalAmount" /&gt;
              &lt;asp:BoundField DataField="loc" HeaderText="LOC" SortExpression="loc" /&gt;
  
              &lt;asp:BoundField DataField="locstatus" HeaderText="LOC status" 
                  SortExpression="locstatus" /&gt;
  
              &lt;asp:BoundField DataField="HoldCalc" HeaderText="Balance" SortExpression="HoldCalc" /&gt;
              &lt;asp:BoundField DataField="odtimes" HeaderText="#OD" SortExpression="odtimes" HeaderStyle-HorizontalAlign="Center" /&gt;
              &lt;asp:BoundField DataField="nfCount" HeaderText="/ #NF" SortExpression="nfCount" HeaderStyle-HorizontalAlign="Center" /&gt;
              &lt;asp:TemplateField&gt;
                  &lt;ItemTemplate&gt;
                      &lt;tr&gt;
  
                      &lt;td colspan="100%"&gt;
                          &lt;div id="gridChild" style="display: inline; position: relative; left: 15px; overflow: auto"&gt;
  
                          &lt;asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false" 
                                  BorderStyle="Double"  BorderColor="#5D7B9D" Width="95%" DataKeyNames="id"&gt;
  
                              &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="true" ForeColor="White" /&gt;
  
                              &lt;RowStyle BackColor="#E1E1E1" /&gt;
  
                              &lt;AlternatingRowStyle BackColor="White" /&gt;
  
                              &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="true" ForeColor="White" /&gt;
  
                              &lt;Columns&gt;
  
                                  &lt;asp:TemplateField HeaderText="Select"&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true"
                                              oncheckedchanged="chkSelect_CheckedChanged" /&gt;
                                      &lt;/ItemTemplate&gt;  
                                  &lt;/asp:TemplateField&gt;
  
                                  &lt;asp:BoundField DataField="effective" HeaderText="Effective" &gt;
                                  &lt;ItemStyle Width="75px" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:BoundField DataField="desc_" HeaderText="Desc" &gt;
                                  &lt;HeaderStyle HorizontalAlign="Center" /&gt;
                                  &lt;ItemStyle Width="150px" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:BoundField DataField="code" HeaderText="TC" 
                                      HeaderStyle-HorizontalAlign="Left" &gt;
                                  &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:BoundField DataField="amount" HeaderText="Amount" 
                                      HeaderStyle-HorizontalAlign="Left" &gt;
                                  &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:BoundField DataField="tracer" HeaderText="Cheq #" 
                                      HeaderStyle-HorizontalAlign="Left" &gt;
                                  &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:BoundField DataField="empl" HeaderText="Empl" 
                                      HeaderStyle-HorizontalAlign="Left" &gt;
                                  &lt;HeaderStyle HorizontalAlign="Left" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:BoundField DataField="balance" HeaderText="OD/EXT Amt"&gt;
                                  &lt;ItemStyle Width="125px" /&gt;
                                  &lt;/asp:BoundField&gt;
                                  &lt;asp:TemplateField HeaderText="Note"&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:DropDownList ID="DropDownNote" runat="server" 
                                             OnSelectedIndexChanged="DropDownNote_SelectedIndexChanged"
                                              AutoPostBack="True"&gt;
                                              &lt;asp:ListItem&gt;&lt;/asp:ListItem&gt;
                                              &lt;asp:ListItem&gt;MWC&lt;/asp:ListItem&gt;
                                              &lt;asp:ListItem&gt;CBM&lt;/asp:ListItem&gt;
                                              &lt;asp:ListItem&gt;Return&lt;/asp:ListItem&gt;
                                              &lt;asp:ListItem&gt;TSF&lt;/asp:ListItem&gt;
                                              &lt;asp:ListItem&gt;OK NO S/C&lt;/asp:ListItem&gt;
                                          &lt;/asp:DropDownList&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField HeaderText="Note1"&gt;
                                      &lt;ItemTemplate&gt;
                                              &lt;asp:DropDownList ID="ddNote2" runat="server" 
                                              OnSelectedIndexChanged="DropDownNote_SelectedIndexChanged" AutoPostBack="True"&gt;
                                                  &lt;asp:ListItem Selected="True"&gt;NSF&lt;/asp:ListItem&gt;
                                                  &lt;asp:ListItem&gt;Funds Not Clear&lt;/asp:ListItem&gt;
                                                  &lt;asp:ListItem&gt;Post Dated&lt;/asp:ListItem&gt;
                                                  &lt;asp:ListItem&gt;Stale Dated&lt;/asp:ListItem&gt;
                                                  &lt;asp:ListItem&gt;Stop Payment&lt;/asp:ListItem&gt;
                                                  &lt;asp:ListItem&gt;Encoding Incorrect&lt;/asp:ListItem&gt;
                                              &lt;/asp:DropDownList&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField HeaderText="Branch"&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:DropDownList ID="ddBranch" runat="server" DataSourceID="BranchDataSource" 
                                              DataTextField="branch" DataValueField="branch" &gt;
                                          &lt;/asp:DropDownList&gt;
                                          &lt;asp:SqlDataSource ID="BranchDataSource" runat="server" 
                                              ConnectionString="&lt;%$ ConnectionStrings:ThirdPartyDataConnectionString %&gt;" 
                                              SelectCommand="SELECT [branch] FROM [branch]"&gt;&lt;/asp:SqlDataSource&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField HeaderText="Account"&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:TextBox ID="TextNo" runat="server" &gt;&lt;/asp:TextBox&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField HeaderText="Type"&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:DropDownList ID="ddType" runat="server" DataSourceID="typeSource" 
                                              DataTextField="Type" DataValueField="Type"&gt;
                                          &lt;/asp:DropDownList&gt;
                                          &lt;asp:SqlDataSource ID="typeSource" runat="server" 
                                              ConnectionString="&lt;%$ ConnectionStrings:ThirdPartyDataConnectionString %&gt;" 
                                              SelectCommand="SELECT [Type] FROM [DMDType]"&gt;&lt;/asp:SqlDataSource&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField HeaderText="Sub"&gt;
                                      &lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextSub" Width="25px" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField HeaderText="ID" Visible="false"&gt;
                                      &lt;ItemTemplate&gt;&lt;asp:TextBox ID="ID" Width="25px" runat="server" Text ='&lt;% Eval("id") %&gt;'&gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
  
                              &lt;/Columns&gt;
                              &lt;RowStyle HorizontalAlign="Center" /&gt;
                          &lt;/asp:GridView&gt;
  
                          &lt;/div&gt; 
                      &lt;/td&gt;
  
                      &lt;/tr&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
          &lt;/Columns&gt;
          &lt;EditRowStyle BackColor="#999999" /&gt;
          &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
          &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" /&gt;
          &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
          &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt;
          &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt;
          &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt;
          &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>When I click the select all checkbox, it selects the checkboxes in the gridview but doesn't fire the backend logic for the checkboxes in the gridview. The logic is that when a checkbox is selected, it should enable other controls within the gridview, code below:</p>
  
  <pre><code>Protected Sub chkSelect_CheckedChanged(sender As Object, e As EventArgs)
  
      For Each row As GridViewRow In GVAccounts.Rows
  
          cmd = New SqlCommand("select submitted, id, effective FROM DmdOD where no = @no and entered = '" &amp; ddDate.SelectedItem.Text &amp; "' order by effective, time_, seqno_dmddmhi_dmhi", conn)
          cmd.Parameters.Add(New SqlParameter("@no", row.Cells(1).Text))
  
          Dim strRead As StringReader = New StringReader(Session("xml").ToString)
  
          Dim xml As XmlTextReader = New XmlTextReader(strRead)
          Dim gvChild As GridView = DirectCast(row.FindControl("gvChildGrid"), GridView)
  
          For Each childrow As GridViewRow In gvChild.Rows
              If chk.Checked Then
  
                  childrow.Cells(8).Enabled = True
                  childrow.Cells(9).Enabled = True
                  childrow.Cells(10).Enabled = True
                  childrow.Cells(11).Enabled = True
                  childrow.Cells(12).Enabled = True
                  childrow.Cells(13).Enabled = True
  
                  LoadXMLFromSession(childrow, hidden)
              Else
  
                  childrow.Cells(8).Enabled = False
                  childrow.Cells(9).Enabled = False
                  childrow.Cells(10).Enabled = False
                  childrow.Cells(11).Enabled = False
                  childrow.Cells(12).Enabled = False
                  childrow.Cells(13).Enabled = False
  
                  LoadXMLFromSession(childrow, hidden)
  
                  'Clear out values when not selected
                  ddNoteList.SelectedIndex = 0
                  ddlNote.SelectedItem.Selected = False
                  ddlNote.Items.FindByValue("").Selected = True
                  ddBranchBox.SelectedIndex = 0
                  txtAccountBox.Text = ""
                  ddTypeBox.SelectedIndex = 0
                  txtSubBox.Text = ""
  
                  LoadDefaultValues()
  
                  WriteXML()
  
                  'LoadXMLFromSession(childrow, hidden)
              End If
          Next
      Next
  
      'CheckForSubmit()
  End Sub
  </code></pre>
  
  <p>What am I missing to get this to behave properly?</p>