control with ID 'ctl00_MainContentPlaceHolder_divDetailsContent' could not be found, but it's right there!
<p>I am trying to add a control I created dynamically, but I get this error:</p>

<p>The TargetControlID of 'abc' is not valid. A control with ID 'ctl00_MainContentPlaceHolder_divDetailsContent' could not be found.</p>

<p>The aspx page looks like this: (PSEUDO CODE ALERT) </p>

<pre><code>.
.
&lt;panel id="myPanel" runat="server" ... &gt;
&lt;div id="divDetailsContent" runat="server" style="width:100%"&gt;
.
.
&lt;% this.Controls.Add(GetAnimationExtender(myPanel)); %&gt;
.
.
</code></pre>

<p>I have tried both the ID and ClientID properties but still the error. Any ideas?</p>

<p>Edit:</p>

<p>Lots of confused answers, here is a shorter version of my method as I commented most of it out, the error is the same with just this code:</p>

<pre><code>public static UpdatePanelAnimationExtender GetAnimationExtender(PlaceHolder loadingMessagePlaceHolder, Control targetControl, UpdatePanel targetPanel)
{

    UpdatePanelAnimationExtender ae = new UpdatePanelAnimationExtender();

    ae.ID = GenerateRandomControlID();
    ae.TargetControlID = targetPanel.ClientID;
  return ae;
}
</code></pre>

<p>It says it cannot find the TargetControlID yet it passes the panel to it</p>
