PDA

Click to See Complete Forum and Search --> : Making a User Control fire an event


wey97
May 26th, 2004, 11:36 AM
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?

Richdef
May 26th, 2004, 02:09 PM
Here is an excellent article which address exactly your issue:
http://www.ftponline.com/vsm/2002_11/online/hottips/delcogliano/default_pf.aspx

I hope this helps!

nemaroller
May 27th, 2004, 07:07 AM
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.

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