title: Loading user control dynamically from server side
body: <p>I have a user control which inherits a class. (and I did some coding on <code>Oninit</code> function of this class). I am loading that user control dynamically from server side using the following approach:</p>
  
  <pre><code>Mycontrol dc = (Mycontrol)Page.LoadControl("/Controls/Mycontrol.ascx");
   MyPlaceHolder.Controls.Add(dc);
  </code></pre>
  
  <p>But the problem is that with this the <code>Oninit</code> function of the class inherited by the user control has not been executed. Can any one please tell me why this is happening and what is the solution for this.</p>
  
  <p>Thanks,</p>