How do I create an event on my custom asp.net control which can bubble up to its parent? I know how to add events and handle them but where I'm getting a bit stuck is on how to add an event which can be wired up to the parent in a repeater control for example.
In the repeater is the control, the onclick event for example connected to the custom control fires and the even fires to whatever address is provided in the onclick event just like any other control would do. I'd also appreciate it if it's in VB but c# will do as well.
EDIT
I was looking around for a simple solution and came across this which works and is very simple to implement. See http://msdn.microsoft.com/en-us/library/db0etb8x(VS.85).aspx for a more detailed example.
Public Event EditClick As EventHandler(Of MyEventArgs)
Public Class MyEventArgs
Inherits EventArgs
Public ItemID As Int32
End Class
Protected Sub EditButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles EditButton.Click
Dim A As New MyEventArgs
A.ItemID = ItemID
RaiseEvent EditClick(Me, A)
End Sub
Then Bind the event.
<uc1:MyItem OnEditClick="EditItem" ...
And the code behind handle the event
Sub EditItem(ByVal sender As Object, ByVal e As MyItem.MyEventArgs)
Edit(e.NewsItemID)
End Sub