My problem:
I have a master page with a list of projects and a button to view those projects. I have a nested master page within the main master page, then a page, and finally a user control.
I need to capture the event in my user control when the button on the main master page has been clicked.
Solution:
What I ended up doing was creating an interface called ISiteMaster. In this interface I define the event I want to subscribe to.
public interface ISiteMaster
{
event CommandEventHandler ViewProjects;
}
I implement the interface from the main master page. In the button event on my master page I then raise this event.
On the user control I then subscribe to this event and assign it to a method.
So now when I click the button on my master page it gets captured in the user control and voila!, the method on my user control is called.

0 comments:
Post a Comment