OnTheAnvil
Regular
I have a simple usercontrol, uc.ascx. In my page load event I have the following code, C#:
if (! this.IsPostBack)
{
System.Web.UI.Control uc;
uc = LoadControl("uc.ascx");
this.Panel1.Controls.Add(uc);
}
When the page first loads I can see my usercontrol in the panel. When I click a button on the page that simply causes a refresh the page refreshes and the usercontrol vanishes. This is a huge problem because the user enters data on the usercontrol that I need to persist across post backs. I also have to add the usercontrol at runtime because I need to load the same control multiple times depending on some data entered from another page.
In short: can I dynamically place a usercontrol at runtime and have it persist postback events. Any help would be appreciated because I'm completely stuck without this functionality.
~OnTheAnvil
if (! this.IsPostBack)
{
System.Web.UI.Control uc;
uc = LoadControl("uc.ascx");
this.Panel1.Controls.Add(uc);
}
When the page first loads I can see my usercontrol in the panel. When I click a button on the page that simply causes a refresh the page refreshes and the usercontrol vanishes. This is a huge problem because the user enters data on the usercontrol that I need to persist across post backs. I also have to add the usercontrol at runtime because I need to load the same control multiple times depending on some data entered from another page.
In short: can I dynamically place a usercontrol at runtime and have it persist postback events. Any help would be appreciated because I'm completely stuck without this functionality.
~OnTheAnvil