how to trigger action in content page from an event on the master

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top