If I understand correctly (with my not so good knowledge of VB.net) you are dynamically adding a button to your user control. But the button click event is never bound. If you just add a handler for button click event on your user control, things would probably work for you.
Another piece of advice when ever playing with dynamic controls always try to add control on page init
or preinit
so you can make use of the advantages of viewstate
.
Edit 1:
I have created a sample for you, that would help you solve the issue. For your user control you can place the button in designer itself (here is what I did): [User Control Designer]
<asp:Button runat="server" ID="button" />
Now on the code behind of the user control, I added the following code: [User Control Code Behind]
Public Event AnEvent()
Protected Sub button_Click(sender As Object, e As EventArgs) Handles button.Click
RaiseEvent AnEvent()
End Sub
botton_Click is the click event of the button added on your user control. The click of this button raises AnEvent. Now this makes your user control a full package having it's own event.
The only thing left to do is add this user control to your page and handle the AnEvent. The following two lines on the page added the user control and handeled the event for me: [Web Page Designer (Adding user control)]
<%@ Register src="WebUserControl1.ascx" tagname="WebUserControl1" tagprefix="uc1" %>
<uc1:WebUserControl1 ID="WebUserControl11" runat="server" OnAnEvent="WebUserControl11_AnEvent" />
Hope this helps.