title: asp.net panel loses viewstate on postback
body: <p>I have a web page with an update panel in it.
  Inside the update panel I have a panel with a user control like this:</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="updatePanel" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"&gt;
  &lt;ContentTemplate&gt;
      &lt;asp:Panel ID="pnlFiles" runat="server" EnableViewState="true"&gt;
          &lt;files:FilesControl runat="server" ID="filesControl" /&gt;
      &lt;/asp:Panel&gt;
  &lt;/ContentTemplate&gt;
  </code></pre>
  
  <p></p>
  
  <p>I have a list of checkboxes that whenever the user checks one of them I want to add another <code>FilesControl</code> to that panel
  so I am doing it like this:</p>
  
  <pre><code>FilesControl files = (FilesControl)LoadControl("~/UserControls/FilesControl.ascx");
  files.ID = XXX;
  pnlFiles.Controls.Add(files); 
  </code></pre>
  
  <p>But on every postback (every checkbox checked) the panel loses the last state and the controls added are wiped out, so the panel actually returns to its initial state every time and I can't ad more and more controls to it.
  I enabled view state and it didn't help.
  What am I missing out here ?</p>