title: C# asp.net Checkbox in checkboxlist returns unchecked always
body: <p>I've been breaking my head on this one for a day now.
  But I just don't see it.</p>
  
  <p>I have a checkboxlist named cblRounds which is </p>
  
  <pre><code>&lt;asp:CheckBoxList ID="cblRondes" runat="server"&gt;
  &lt;/asp:CheckBoxList&gt;
  </code></pre>
  
  <p>Also to note, EnableViewstate is set to true.</p>
  
  <p>In my code behind, in the page_Load i fill de list like this:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
  
      if (!IsPostBack)
      {
          dpPrintRounds.FieldValue = DateTime.Now.AddDays(1);
  
      }
      FillCheckBoxList(); 
  }
  
  private void FillCheckBoxList()
  {
      tourCollectie = new LogisticsTourCollection();
      RelationCollection rc = new RelationCollection(LogisticsItemEntity.Relations.LogisticsItemSpecsEntityUsingSeqSpecs);
      rc.Add(LogisticsItemSpecsEntity.Relations.LocationEntityUsingSeqLocationDelivery);
      rc.Add(LocationEntity.Relations.LocationLogisticsTourEntityUsingSeqLocation);
      rc.Add(LocationLogisticsTourEntity.Relations.LogisticsTourEntityUsingSeqLogisticsTour);
      PredicateExpression pe = new PredicateExpression(LogisticsItemSpecsFields.RequiredDeliveryDate == dpPrintRounds.FieldValue);
      pe.Add(LogisticsItemFields.DeliveryNumber != DBNull.Value);
      tourCollectie.GetMulti(pe, rc);
  
      cblRondes.Items.Clear();
      foreach (LogisticsTourEntity tour in tourCollectie)
      {
          cblRondes.Items.Add(new ListItem(tour.Name, tour.SeqLogisticsTour.ToString()));
      }        
  }
  </code></pre>
  
  <p>Then I click a button where I check the checkstate of the checkboxes</p>
  
  <pre><code>protected void btnPrintHeaders_Click(object sender, EventArgs e)
  {
      PrintRounds();
  }
  
  private void PrintRounds()
  {
      if (dpPrintRounds.Date_Selected.HasValue)
      {            
          Dictionary&lt;string, string&gt; rondes = new Dictionary&lt;string, string&gt;();
          foreach (ListItem item in cblRounds.Items)
          {
              if (item.Selected)
              {
                  rondes.Add(item.Value, GetDeliveryNumberFromRonde(item.Value));
              }
          }            
  
  
      }
  }
  </code></pre>
  
  <p>Everything works correct except that the if (item.Selected) always returns false.</p>
  
  <p>Also I have</p>
  
  <pre><code>&lt;td&gt;
              &lt;rm:DatePicker ID="dpPrintRounds" runat="server" /&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;asp:Button ID="btnSearch" runat="server" Visible="true" 
                  onclick="btnSearch_Click" /&gt;
              &lt;%--&lt;asp:Literal ID="litLogisticsRoundName" runat="server" /&gt;:--%&gt;
          &lt;/td&gt;
  </code></pre>
  
  <p>The Datepicker returns a date I use to filter my collection.
  So when I press the searchbutton, I get "new" checkboxes in my checkboxlist.
  This is why I DON'T have the Fillcheckboxlist inside the  if(!IsPostBack) else I get no checkboxes on a new search.</p>
  
  <p>I've been searching for an answer on this and tried several things but none seem to work.
  Any ideas are appreciated.</p>