Hi,
I have been trying to follow a tutorial on raising an event from a user
control and then handling it in the parent page.
The article is a little vague so I believe I have the code in place, but I
cant seem to get it to work.
Here is what I have:
' This is in the ascx control:
' GeneralInfo is an ImageButton in the ascx file
Public MustInherit Class EmployeeNavigat ion
Inherits System.Web.UI.U serControl
Public Event GeneralInfoClic ked(ByVal sender As System.Object, ByVal e
As System.Web.UI.I mageClickEventA rgs)
' This fires when the imagebutton is clickedPrivate Sub
GeneralInfo_Cli cked(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles GeneralInfo.Cli ck
RaiseEvent GeneralInfoClic ked(sender, e)
End Sub
End Class
This is excerpts of the code I have in the aspx page which inherits the ascx
page above.
Protected WithEvents EmployeeNavigat ion As EmployeeNavigat ion
Private Sub GeneralInfo_Cli cked(ByVal sender As Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles
EmployeeNavigat ion.GeneralInfo Clicked
Response.Write( "<BEVENT FIRED!</b>")
End Sub
I have been trying to follow a tutorial on raising an event from a user
control and then handling it in the parent page.
The article is a little vague so I believe I have the code in place, but I
cant seem to get it to work.
Here is what I have:
' This is in the ascx control:
' GeneralInfo is an ImageButton in the ascx file
Public MustInherit Class EmployeeNavigat ion
Inherits System.Web.UI.U serControl
Public Event GeneralInfoClic ked(ByVal sender As System.Object, ByVal e
As System.Web.UI.I mageClickEventA rgs)
' This fires when the imagebutton is clickedPrivate Sub
GeneralInfo_Cli cked(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles GeneralInfo.Cli ck
RaiseEvent GeneralInfoClic ked(sender, e)
End Sub
End Class
This is excerpts of the code I have in the aspx page which inherits the ascx
page above.
Protected WithEvents EmployeeNavigat ion As EmployeeNavigat ion
Private Sub GeneralInfo_Cli cked(ByVal sender As Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles
EmployeeNavigat ion.GeneralInfo Clicked
Response.Write( "<BEVENT FIRED!</b>")
End Sub
Comment