G
Guest
vs2005, .net fw 2.0
the questions is, how can I cause the label to change in my client page
triggered by an event raised from the user control which is on my master page.
I have a master page (M) which contain a user control (U).
My client page (C) has a sub that needs to run if U raise an event.
The examlpe has been simplified to just button clicks and update label with
new messages.
Source ....
=====user control=====
Partial Class WebUserControl
Inherits System.Web.UI.UserControl
Implements ifMyUserControl
Public Interface ifMyUserControl
Event btClicked()
End Interface
Public Event wasClicked() Implements ifMyUserControl.btClicked
Protected Sub btFireEvent_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btFireEvent.Click
RaiseEvent wasClicked()
End Sub
End Class
==== Master Page ====
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Private Sub gotEvent() Handles WebUserControl1.wasClicked
Label1.Text = "WebUserControl's button was clicked and triggerd the
wasClicked Event and is handled in Masterpage."
End Sub
End Class
==== Client Page =====
Partial Class testFire
Inherits System.Web.UI.Page
' how to cause this sub to fire when the button in U is clicked?
Public Sub catchEvents()
Label1.Text = "Like to be able to update this when the WebUserControl's
wasClicked event was raised"
End Sub
End Class
the questions is, how can I cause the label to change in my client page
triggered by an event raised from the user control which is on my master page.
I have a master page (M) which contain a user control (U).
My client page (C) has a sub that needs to run if U raise an event.
The examlpe has been simplified to just button clicks and update label with
new messages.
Source ....
=====user control=====
Partial Class WebUserControl
Inherits System.Web.UI.UserControl
Implements ifMyUserControl
Public Interface ifMyUserControl
Event btClicked()
End Interface
Public Event wasClicked() Implements ifMyUserControl.btClicked
Protected Sub btFireEvent_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btFireEvent.Click
RaiseEvent wasClicked()
End Sub
End Class
==== Master Page ====
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Private Sub gotEvent() Handles WebUserControl1.wasClicked
Label1.Text = "WebUserControl's button was clicked and triggerd the
wasClicked Event and is handled in Masterpage."
End Sub
End Class
==== Client Page =====
Partial Class testFire
Inherits System.Web.UI.Page
' how to cause this sub to fire when the button in U is clicked?
Public Sub catchEvents()
Label1.Text = "Like to be able to update this when the WebUserControl's
wasClicked event was raised"
End Sub
End Class