V
Vi
Hi,
I created a web user control that works fine to display some data. Now I
want to be able to read a public int variable from the control, but I always
get the value I'm innitilizing the variable with. Meaning I can't get the
value that is set within the control.
Here's the code I use:
Control ctl1 = LoadControl("../controls/ctl1.ascx");
((MyNamespace.ControlName)ctl1).id = myInitID;
iVarFromTheControl = ((MyNamespace.ControlName)ctl1).iVarFromTheControl;
PlaceHolder1.Controls.Add(ctl1);
This code is in Page_Load and debugging step-by-step I saw that the
control's code is executed only after Page_Load has finished executing. So I
guess that's the problem, but I'm not sure how to solve it.
Thanks.
I created a web user control that works fine to display some data. Now I
want to be able to read a public int variable from the control, but I always
get the value I'm innitilizing the variable with. Meaning I can't get the
value that is set within the control.
Here's the code I use:
Control ctl1 = LoadControl("../controls/ctl1.ascx");
((MyNamespace.ControlName)ctl1).id = myInitID;
iVarFromTheControl = ((MyNamespace.ControlName)ctl1).iVarFromTheControl;
PlaceHolder1.Controls.Add(ctl1);
This code is in Page_Load and debugging step-by-step I saw that the
control's code is executed only after Page_Load has finished executing. So I
guess that's the problem, but I'm not sure how to solve it.
Thanks.