title: runat="server" div causes System.Web.HttpException when accessed from control collection
body: <p>I have a div that is runat="server".  The div is contained in a panel, and within the div are some controls.  All of the controls outside of the div (but within the panel) are cleared when I run my "ClearControlsInPanel()" method, which looks like this:</p>
  
  <pre><code>public static void ClearControlsInPanel(Panel paneltoclear, string[] ignorelist)
  {
      foreach (Control c1 in paneltoclear.Controls)
      {
          if (c1 is TextBox)
          {
              if (!ignorelist.Contains(c1.ID.ToString()))
              {
                  ((TextBox)c1).Text = "";
              }
          }
          if (c1 is DropDownList)
          {
              if (!ignorelist.Contains(c1.ID.ToString()))
              {
                  ((DropDownList)c1).SelectedIndex = 0;
              }
          }
          //etc.
      }
  }
  </code></pre>
  
  <p>Once the div is reached, I cannot see the controls in it, and thus none of those controls get cleared.  Ironically I found a guy who made a post about the <em>exact</em> same thing, <a href="http://www.velocityreviews.com/forums/t505290-why-adding-runat-server-to-a-div-tag-throws-an-exception-of-type-system-web-httpexception-in-controls-collection.html" rel="nofollow">Why adding runat=server to a div tag throws an exception of type 'System.Web.HttpException in controls collection?</a>  But the thread ends, with no real solution or explanation.</p>
  
  <p>The full exception is: </p>
  
  <pre><code>base {System.Web.UI.HtmlControls.HtmlContainerControl} = {InnerText = 
  '((System.Web.UI.HtmlControls.HtmlContainerControl)
  (((System.Web.UI.HtmlControls.HtmlGenericControl)(paneltoclear.Controls._controls
  [165])))).InnerText' threw an exception of type 'System.Web.HttpException'}
  </code></pre>
  
  <p>Please assume that this must remain a runat server div, and cannot be changed to a panel.  (I'm almost certain changing it to a panel will solve it, but we have other requirements that need this to be a runat server div (long story)).</p>