Clear dynamic UserControl container
<p>How can I make _dynamicMaterials empty or clear the viewstate?</p>

<p>When the user clicks on submit I want to reset the container so all textboxes are empty.</p>

<p>Any ideas how I can work this out?      </p>

<pre><code>    private materials[] _dynamicMaterials; // Container for dynamically added UserControl "materials.ascx"

    protected void Page_PreInit(object sender, EventArgs e)
    {
        GetPostBackControl(Page);
    }


    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        if (!this.DesignMode)
        {
            int count = MySession.Current.UserControlCount;
            _dynamicMaterials = new materials[count];

            for (int i = 0; i &lt; count; i += 1)
            {
                Control newcont = LoadControl("materials.ascx");
                newcont.ID = "materialControl" + i.ToString();
                myPlaceHolder1.Controls.Add(newcont);
                _dynamicMaterials[i] = (materials)newcont;
            }
        }
    }
</code></pre>
