M
Mike Collins
I have a web app that when I click a menu, I load a control. On one of these
controls, I have a button that when clicked, I need to unload the control to
unload itself and load a different control in its place. I am not sure how to
do this from within a control itself. Can anyone offer any help and show me
what I am doing wrong with my code below?
//This is on one of my controls.
protected void btnSubmit_Click(object sender, EventArgs e)
{
Control ctl = new Control();
ctl = LoadControl(@"~\UserControls\Marketing\ManageCampaigns.ascx");
ctl.ID = "campaignWizard";
ctl.EnableViewState = true;
Control parent = new Control();
parent = this.Parent.FindControl("PlaceHolder1");
parent.Controls.Clear();
parent.Controls.Add(ctl);
}
controls, I have a button that when clicked, I need to unload the control to
unload itself and load a different control in its place. I am not sure how to
do this from within a control itself. Can anyone offer any help and show me
what I am doing wrong with my code below?
//This is on one of my controls.
protected void btnSubmit_Click(object sender, EventArgs e)
{
Control ctl = new Control();
ctl = LoadControl(@"~\UserControls\Marketing\ManageCampaigns.ascx");
ctl.ID = "campaignWizard";
ctl.EnableViewState = true;
Control parent = new Control();
parent = this.Parent.FindControl("PlaceHolder1");
parent.Controls.Clear();
parent.Controls.Add(ctl);
}