Dynamically load user controls on button click, postback issue
<p>I'm trying to load usercontrols on button click, but problem is that, it disappears on postback inside user control.</p>

<p>this is how i load controls:</p>

<pre><code>private bool IsUserControl
{
    get
    {
        if (ViewState["IsUserControl"] != null)
        {
            return (bool)ViewState["IsUserControl"];
        }
        else
        {
            return false;
        }
    }
    set
    {
        ViewState["IsUserControl"] = value;
    }
}


#region Usercontrols
private void CreateUserControlAllNews()
{
    Control featuredProduct = Page.LoadControl("path/usercontrol.ascx");
    plh1.Controls.Add(featuredProduct);
}

#endregion
protected void allNewsbtn_Click(object sender, EventArgs e)
{

    this.IsUserControl = true;
    if(IsUserControl)
    CreateUserControlAllNews();
}
</code></pre>
