As it turns out, you cannot use a disposable to create an eventHandler!
Using newbutton As New HtmlButton
newbutton.ID = "somebutton"
newbutton.InnerText = "Click"
AddHandler newbutton.ServerClick, AddressOf Me.buttonEventHandler
resultBox.Controls.Add(newbutton)
End Using
The above won't work because the newbutton is disposed at "End Using".. Also disposing the handler. That is why it won't fire at the event.
You will have to use a explicit button like :
Dim button_buttonName as New HTMLButton
button_buttonName.ID = "buttonName"
button_buttonName.InnerText = "Click"
AddHandler button_buttonName.ServerClick, AddressOf Me.buttonEventHandler
resultBox.Controls.Add(button_buttonName)
This mean you have to name all buttons uniquely when you assign AddHandlers to them.