ASP.NET Page Inheritance and Overriding onInit
<pre><code> protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    var template = LoadControl(Path);
    if (template == null)
        throw new Exception("Could not located the Template");



    var templateControl = template.FindControl("_placeHolder");
    if (templateControl == null)
        throw new Exception("Could not located the Place Holder");

    templateControl.Controls.Add(_container);

    //This doesnt Work
    for (var i = 0; i &lt; template.Controls.Count;i++ )
    {
        var myControl = template.Controls[i];
        Controls.Add(myControl);
    }
    //This works
    for (var i = 0; i &lt; template.Controls.Count; i++)
    {
        var myControl = template.Controls[0];
        template.Controls.Remove(myControl);
        Controls.Add(myControl);
    }

}
</code></pre>

<p>This is just a Tutorial I am working on. The question is Why does the Second for loop display the output on the page and the first one does not. I do comment out one of them to test this. What exactly am i missing and why do i need to remove the control?</p>
