title: ASP.NET Checkbox control in the Repeater is always unchecked
body: <p>I have problem with my own created User control. If I click on the checkbox the <code>Checked</code> property is always <code>false</code>, why ?</p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" EnableViewState="true" CodeBehind="MyCtrl.ascx.cs" Inherits="MyCtrl" %&gt;
  
  &lt;asp:CheckBox ID="attrCb" runat="server"
                AutoPostBack="true" 
                oncheckedchanged="cb_CheckedChanged" /&gt;
  </code></pre>
  
  <p>cs file</p>
  
  <pre><code>public bool IsChecked { get { return ViewState["IsChecked"] != null ? (bool)ViewState["IsChecked"] : false; } set { ViewState["IsChecked"] = value; } }
  
  protected void cb_CheckedChanged(object sender, EventArgs e)
  {
      IsChecked = attrCb.Checked;
  }
  </code></pre>
  
  <p>aspx snippet</p>
  
  <pre><code>&lt;asp:Repeater ID="QuestionnaireRepeater" runat="server"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;tr&gt;                            
                          &lt;td&gt;&lt;mytag:MyCtrl OnCheckedChange="On_CheckedChanged" ID="attrCb1" runat="server" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;mytag:MyCtrl OnCheckedChange="On_CheckedChanged" ID="attrCb2" runat="server" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;mytag:MyCtrl OnCheckedChange="On_CheckedChanged" ID="attrCb3" runat="server" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;mytag:MyCtrl OnCheckedChange="On_CheckedChanged" ID="attrCb4" runat="server" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;mytag:MyCtrl OnCheckedChange="On_CheckedChanged" ID="attrCb5" runat="server" /&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;mytag:MyCtrl OnCheckedChange="On_CheckedChanged" ID="attrCb6" runat="server" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:Repeater&gt;
  </code></pre>
  
  <h2>edit</h2>
  
  <p>I've made some changes, it doesn't work too (according to the <a href="https://stackoverflow.com/questions/7346324/exposing-events-from-asp-net-usercontrols-to-container-web-forms-page">Exposing Events from asp.net usercontrols to container web forms page</a>)</p>
  
  <p>I still see <code>false</code></p>
  
  <p>inside MyCtrl.ascx</p>
  
  <pre><code>&lt;asp:CheckBox ID="attrCb" runat="server"
                AutoPostBack="true"
                oncheckedchanged="Cb_CheckedChanged1" /&gt;
  </code></pre>
  
  <p>inside MyCtrl.cs I added</p>
  
  <pre><code>    public event EventHandler CheckedChange;
      private void OnCheckedChange(object sender, EventArgs ea)
      {
          var e = CheckedChange;
  
          if (e != null)
              e(this, ea);
      }
  
      protected void Cb_CheckedChanged1(object sender, EventArgs e)
      {
          OnCheckedChange(sender, e);
      }
  </code></pre>
  
  <p>inside my aspx page:</p>
  
  <pre><code>    protected void On_CheckedChanged(object sender, EventArgs e)
      {
          MyCrtl cbCtrl = ((MyCrtl)sender);
  
          cbCtrl.IsChecked = cbCtrl.attrCb.Checked; //attrCb is exposed
                                                   //Checked is still false
      }
  </code></pre>