R
RSH
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 EmployeeNavigation
Inherits System.Web.UI.UserControl
Public Event GeneralInfoClicked(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs)
' This fires when the imagebutton is clickedPrivate Sub
GeneralInfo_Clicked(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles GeneralInfo.Click
RaiseEvent GeneralInfoClicked(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 EmployeeNavigation As EmployeeNavigation
Private Sub GeneralInfo_Clicked(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles
EmployeeNavigation.GeneralInfoClicked
Response.Write("<B> EVENT 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 EmployeeNavigation
Inherits System.Web.UI.UserControl
Public Event GeneralInfoClicked(ByVal sender As System.Object, ByVal e
As System.Web.UI.ImageClickEventArgs)
' This fires when the imagebutton is clickedPrivate Sub
GeneralInfo_Clicked(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles GeneralInfo.Click
RaiseEvent GeneralInfoClicked(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 EmployeeNavigation As EmployeeNavigation
Private Sub GeneralInfo_Clicked(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles
EmployeeNavigation.GeneralInfoClicked
Response.Write("<B> EVENT FIRED!</b>")
End Sub