Hi,
I am not able to replicate the issue. I tried the following code and it
worked.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim control As UserControl =
CType(LoadControl("~/WebUserControl.ascx"), UserControl)
Me.form1.Controls.Add(control)
End Sub
In wEbuserControl.ascx,
I have put the button control.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Response.Write("test")
End Sub
Regards,
Manish
www.componentone.com
"רמי" wrote:
Hey,
I'm loading a webusercontrol dynamically using The following code:
Control newCtrl = LoadControl("MyCtrl.ascx");
newCtrl.ID = "MyCONTROL";
container.Control.Add(newCtrl);
My webusercontrol has a server-side button and it I implemented its
OnClick event.
On the Init event of the Page, I re add the control on each post back.
And yet while pressing the button does postback, it doesn't wire my
events and the OnClick is never executed.
What am I missing?!
Thanks ahead
--sternr