title: Checkbox in TemplateField in Gridview loses checked on postback
body: <p>I have a gridview with a template field.  In that template field is a checkbox.  I have a submit button outside of the gridview to assign the records that were checked.  On the postback no checkboxes register as being checked.  Here is my Code:</p>
  
  <pre><code>&lt;Columns&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:CheckBox ID="cb" Checked="false" runat="server" /&gt;
                          &lt;asp:Label ID="lblCFID" runat="server" Visible="false" Text='&lt;%# Eval("ID") %&gt;' /&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" DataField="Name" HeaderText="Name" /&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" DataField="DOB" HeaderText="Date of Birth" /&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" HeaderText="Gender" DataField="Gender"  /&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" HeaderText="Status" DataField="Status"  /&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" HeaderText="Plan Name" DataField="PlanName"  /&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" HeaderText="Type" DataField="ControlType"  /&gt;
                  &lt;asp:BoundField HeaderStyle-HorizontalAlign="Center" HeaderText="Date of Service" dataformatstring="{0:MMMM d, yyyy}" htmlencode="false" DataField="DateofService"  /&gt;
              &lt;/Columns&gt;
  
  protected void AssignRecords(object sender, EventArgs e)
  {
      int Rows = gvASH.Rows.Count;
      for (int i = 0; i &lt; Rows; i++)
      {
          //CheckBoxField cb = ((CheckBoxField)gvASH.Rows[i].Cells[1]).;
          CheckBox cb = (CheckBox)gvASH.Rows[i].Cells[0].FindControl("cb");
          Label lblID = (Label)gvASH.Rows[i].Cells[0].FindControl("lblCFID");
          if (cb.Checked == true)
          {
  
              string ID = lblID.Text;
              //Assign Code
          }
      }
  }
  </code></pre>
  
  <p>I have a breakpoint set on the string ID = lblID.Text; but it never finds any that are checked.</p>