title: Unable to find checkbox by ID in a GridView based on HiddenField value
body: <p>I have a GridView in ASP.NET, inside a column on this GridView I have the below controls:</p>
  
  <pre><code>&lt;asp:TemplateField&gt;       
      &lt;ItemTemplate&gt;
          &lt;input id='&lt;%#Eval("po_asn_number") %&gt;' class="css-checkbox" type="checkbox" /&gt;                                                       
          &lt;label for='&lt;%#Eval("po_asn_number") %&gt;' name="lbl_1" class="css-label"&gt;&lt;/label&gt;        
  
          &lt;asp:HiddenField ID="poid" runat="server" Value='&lt;%#Eval("po_asn_number") %&gt;' /&gt;
      &lt;/ItemTemplate&gt;                     
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>This is my OnClick event in the Code Behind.</p>
  
  <pre><code>protected void create_Click(object sender, EventArgs e)
  {
      foreach (GridViewRow gvr in GridView1.Rows)
      {
          HiddenField poid = ((HiddenField)gvr.Cells[0].FindControl("poid"));
  
          if (((HtmlInputCheckBox)gvr.FindControl(poid.Value)).Checked == true)
          {
              Response.Redirect("ShipmentDetail.aspx?id=" + poid.Value);
          }
          else
          {
              //Do nothing
          }
      }
  }
  </code></pre>
  
  <p>What I'm trying to do here first, I look for a HiddenField which the value is the ID for the <code>&lt;input type="checkbox" /&gt;</code>. I am then checking to see if the <code>checkbox</code> is checked. If it is then do something else do nothing.</p>
  
  <p>When click the button I get an error:</p>
  
  <p><code>Object reference not set to an instance of an object</code></p>
  
  <pre><code>Line 48:             if (((HtmlInputCheckBox)gvr.FindControl(checkbox)).Checked == true)
  Line 49:             {
  Line 50:                 Response.Redirect("ShipmentDetail.aspx?id=" + poid.Value);
  </code></pre>
  
  <p>Any help you can provide will appreciated.</p>