title: Checkbox disappeared by unchecking it in asp.net
body: <p>I have a problem with checkbox. For example, I have this aspx's code</p>
  
  <pre><code>&lt;asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server"&gt;
       &lt;asp:CheckBox ID="chkActive" AutoPostBack="True" OnCheckedChanged="Active_OnCheckedChanged" runat="server"&gt;&lt;/asp:CheckBox&gt;
       &lt;asp:TextBox ID="txtName" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>At server side, when chkActive is checked, I have two rendered controls:</p>
  
  <ul>
  <li>ctl00$MainContent$chkActive </li>
  <li>ctl00$MainContent$txtName</li>
  </ul>
  
  <p>when chkActive is unchecked, I have only one rendered control:</p>
  
  <ul>
  <li>ctl00$MainContent$txtName</li>
  </ul>
  
  <p>So I cannot write the status of that checkbox to database. For the record, I use a SaveData function with dynamic object, and chkActive disappeared when unchecked, so this function couldn't find it. Any idea to make checkbox appeared even when it's unchecked? Thanks.</p>
  
  <p>P.S: "disappeared" means it's not in Request.Form anymore when unchecked.</p>
  
  <p>Edited:</p>
  
  <p>My SaveData function:</p>
  
  <pre><code>public void SaveDate&lt;T&gt;(T entity, NameValueCollection attributes)
      {
          PropertyInfo[] properties = typeof(T).GetProperties();
          foreach (PropertyInfo property in properties)
          {
              if (attributes.AllKeys.Any(key =&gt; key.Contains("$" + property.Name)))
              {
                  //
              }
          }            
      }
  </code></pre>
  
  <p>The para attributes is from Request.Form, since checkbox is not in Request.Form anymore, so I don't know how to handle it. This function works well in case checkbox is checked</p>