see07
Regular
I have a web form, which has a place holder named Example when, Page_Load happens in my web form. Im creating dynamically a WUC named WebUserControl3 into my place holder.
WebUserControl3 has several text boxes, a button and a label, when user click button Im executing some calculation which result Im placing into label. But when user click button occurs Page_Load in web form that contains my place holder and I need recreate my WUC plus data was contained therein, I have tried with ViewState and Session variables but still I cant pass data from WUC to web form to recreate WUC and its data. Obviously WUC is created again without data. Notwithstanding if I re-enter data in WUC and click button again data are displayed OK.
Why first time it isnt working and begin second try its working fine?
My code is:
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
}
else
{
Example.Controls.Clear();
Control control = this.Page.LoadControl("WebUserControl3.ascx");
Example.Controls.Add(control);
}
}
Thanks in advance
A.L.
WebUserControl3 has several text boxes, a button and a label, when user click button Im executing some calculation which result Im placing into label. But when user click button occurs Page_Load in web form that contains my place holder and I need recreate my WUC plus data was contained therein, I have tried with ViewState and Session variables but still I cant pass data from WUC to web form to recreate WUC and its data. Obviously WUC is created again without data. Notwithstanding if I re-enter data in WUC and click button again data are displayed OK.
Why first time it isnt working and begin second try its working fine?
My code is:
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
}
else
{
Example.Controls.Clear();
Control control = this.Page.LoadControl("WebUserControl3.ascx");
Example.Controls.Add(control);
}
}
Thanks in advance
A.L.