By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,750 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,750 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

May 10 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.