Murray Brown
asked on
ASP.net VB.net Dynamically add code behind a button
Hi. I use the following code to add a button dynamically to a web page.
Is it possible to add code behind the button click?
Dim btn As New Button
btn.Text = "Push me!"
Panel1.Controls.Add(btn)
Is it possible to add code behind the button click?
Dim btn As New Button
btn.Text = "Push me!"
Panel1.Controls.Add(btn)
ASKER
Hi. Thanks. What code would I use to add the handler
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much
Not a problem, glad to help.
This should give you what you need. Use the AddHandler to add a click event handler to btn and give it the address of the event handler you want to give to the btn object as shown below.
Open in new window