title: How do I access the checkbox in listview?
body: <p>I'm trying to access the ID as FindControl but it doesn't return the value, giving me the object not instantiated error.
  How can I access its ID?
  I've tried several things and so far I don't know how to solve this problem.
  PS: I'm new to C# programming</p>
  <h2>ASP.NET</h2>
  <pre><code>&lt;ItemTemplate &gt;
                                              &lt;tr id=&quot;item&quot; runat=&quot;server&quot; class=&quot;row&quot;&gt;
                                                  &lt;td class=&quot;first&quot;&gt;
                                                      &lt;asp:Label ID=&quot;lblNumero_titulo&quot; runat=&quot;server&quot; Text='&lt;%# Eval(&quot;numero_titulo&quot;) %&gt;' /&gt;&lt;br /&gt;
                                                  &lt;/td&gt;
                                                  &lt;td&gt;&lt;%# Eval(&quot;razao_social&quot;) %&gt;&lt;/td&gt;
                                                  &lt;td&gt;&lt;%# Eval(&quot;hora_entrega&quot;)%&gt;&lt;/td&gt;
                                                  &lt;td&gt;&lt;%# Eval(&quot;quem_recebeu&quot;)%&gt;&lt;/td&gt;
                                                  &lt;td&gt;
                                                      &lt;asp:CheckBox ID=&quot;testecb&quot; runat=&quot;server&quot; /&gt; &lt;/td&gt;
                                                  &lt;td&gt;
                                                      &lt;asp:Label ID=&quot;lblCodEntrega&quot;Visible=&quot;false&quot; runat=&quot;server&quot; Text='&lt;%# Eval(&quot;cod_entrega&quot;) %&gt;' /&gt;&lt;br /&gt;
                                                  &lt;/td&gt;                                                  
                                              &lt;/tr&gt;
                                          &lt;/ItemTemplate&gt;
  </code></pre>
  <h2>C#</h2>
  <pre><code>protected void btnPesquisar_Click(object sender, EventArgs e)
      {
          limpaCampos();
          using (PrincipalDataContext pdc = new PrincipalDataContext())
          {
  
              if (!string.IsNullOrEmpty(txtCodRomaneio.Text))
              {
                  var romaneios = pdc.z_stp_anb_transp_receb(Convert.ToInt32(txtCodRomaneio.Text)).ToList();
                  var r = romaneios.First();
                  var check = lvNotas.FindControl(&quot;testecb&quot;) as CheckBox;
  
                  if (romaneios != null)
                  {
  
                      if (r.status == 1)
                      {
                         check.Checked = true;
                         check.Enabled = false;
  
                      }
  
                      lvNotas.DataSource = romaneios;
                      lvNotas.DataBind();
                  }
                  else
                  {
                      ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, &quot;alert('Romaneio não encontrado!')&quot;, true);
                  }
              }
          }
      }
  </code></pre>