title: ASP.NET CheckBox.Checked is always false in ListView
body: <p>I have a ListView with a couple of checkboxes. But if I want to know if the checkboxes are checked, it is always false (even if i checked it).</p>
  
  <p>This is the code of my ListView</p>
  
  <pre><code>&lt;asp:ListView ID="lvCompanies" runat="server" DataKeyNames="id" onitemdatabound="lvCompanies_ItemDataBound"&gt;
      &lt;LayoutTemplate&gt;&lt;ul&gt;&lt;asp:PlaceHolder runat="server" ID="itemPlaceholder"&gt;&lt;/asp:PlaceHolder&gt;&lt;/ul&gt;&lt;/LayoutTemplate&gt;
      &lt;ItemTemplate&gt;                
          &lt;li&gt;
              &lt;asp:CheckBox ID="cbCompany" CssClass="checkbox company-checkbox"  runat="server" /&gt;
              &lt;%# Eval("Name") %&gt;
          &lt;/li&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:ListView&gt;  
  </code></pre>
  
  <p>And this is how I tried to get the checked Checkboxes</p>
  
  <pre><code>    public List&lt;Company&gt; getSelectedItems()
      {
          foreach (ListViewDataItem dataItem in lvCompanies.Items)
          {
              bool isChecked = ((CheckBox)dataItem.FindControl("cbCompany")).Checked;
  
          }
      }
  </code></pre>
  
  <p>Do you have any idea why my checkbox have always Checked = false?</p>
  
  <p>Thanks a lot,</p>
  
  <p>Vincent</p>