Let's say I have a user control with a couple of buttons.
I need an event to fire on my page when either of these buttons is clicked.
How can I do that?
Printable View
Let's say I have a user control with a couple of buttons.
I need an event to fire on my page when either of these buttons is clicked.
How can I do that?
Here is an excellent article which address exactly your issue:
http://www.ftponline.com/vsm/2002_11...efault_pf.aspx
I hope this helps!
You can simply declare a public event at the top of your user control class, and whenever a button is clicked on your usercontrol, handle the event and raise the public event.
VB Code:
Public Class myusercontrol Public Event SaveRequested Private Sub SaveButton_Click(sender as Object, e as System.event.args) Handles SaveButton.Click RaiseEvent SaveRequested End Sub End Class