title: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
body: <p>I am trying to add a panel as a child control of another panel in the codebehind of a master page, it's a simple as:</p>
  
  <pre><code>Panel1.Controls.Add(Panel2)
  </code></pre>
  
  <p>However when I try to do that, I get this error:</p>
  
  <pre><code>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).
  </code></pre>
  
  <p>There are a number of questions that talk about having &lt;%= %> elements in the head section, which I do not have. I have been so far as to remove all &lt;% %> elements from this page, to no avail, the error still occurs. Can anyone suggest a way to get this to work?</p>