Why my events aren't registered after postback?
<p>I have a problem where I have a page with a checkbox :</p>

<pre><code>&lt;asp:CheckBox runat="server" ID="chkSelectAll" OnCheckedChanged="chkSelectAll_CheckedChanged" EnableViewState="true" Text='&lt;%# CommonFunctions.GetText(Page, "CreateTask", "chkSelectAll.text") %&gt;' AutoPostBack="true" /&gt;
</code></pre>

<p>First I had the problem that when the event was raised the checkbox wasn't keeping the checked property value. This is still strange because nowhere in the application we set the EnableViewState to false and by default it should be true. Well this behavior was fixed by puting EnableViewState="true".</p>

<p>So now, I have a checkbox that when I first load the page, wworks correctly. I check the box, the event is raised Checked property valu is good and the method is executed. Postback completes and renders the page. I check the box back to false, the event is not triggered and the page is reloaded with the previous data but the Checked Property stays at true.</p>

<p>So after the first postback I seem to loose behavior of event and ViewState.</p>

<p>We suspect the fact that we move dynamically the controls in the page (See answer <a href="http://stackoverflow.com/questions/375093/asp-net-possible-to-create-a-usercontrol-that-include-inside-markup-content">here</a>)</p>

<p>But this suspicion doesn't explain why everything works perfectly after the first load and stops working after first PostBack.</p>

<p><strong>EDIT</strong></p>

<p><a href="http://www.mediafire.com/?14udjznyjmj" rel="nofollow"><strong>CODE SAMPLE</strong></a></p>

<p>I created a test project where you can experience my problem. At load if you check any checkbox both raise their respective event. After postback only the second raise both events. I seem to have a problem when I register the events after moving control.</p>
