title: How to get the value of input type checkbox in RepeaterItems (ASP.NET)?
body: <p>i have button delete message from database but i cant get value from checked checkbox in repeateritem. how can i do that?
  this my btndelete:</p>
  
  <pre><code>protected void btnDelete_Click(object sender, EventArgs e)
  {
      foreach (RepeaterItem aItem in rptInbox.Items)
      {
          HtmlInputCheckBox chk = (HtmlInputCheckBox)aItem.FindControl("chkRow");
  
          if (chk.Checked == true)
          {
              string id = chk.Value.ToString();
  
              SqlConnection con = new SqlConnection(conStr);
              SqlCommand cmd = new SqlCommand("delete from mailbox where mailboxid='"+id+"'", con);
              try
              {
                  con.Open();
                  cmd.ExecuteNonQuery();
              }
              catch (Exception er)
              {
  
              }
              finally
              {
                  con.Close();
              }
          }
      }
  }
  </code></pre>
  
  <p>this my html:</p>
  
  <pre><code>&lt;asp:Repeater ID="rptInbox" runat="server"&gt;
      &lt;ItemTemplate&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type="checkbox" ID="chkRow" value='&lt;%#Eval("mailboxid")%&gt;' runat="server"/&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%#Eval("from") %&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href="InboxDetail.aspx?MailboxId=&lt;%#Eval("mailboxid") %&gt;"&gt;&lt;%#Eval("subject") %&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;&lt;%#Eval("date") %&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt; 
  </code></pre>