I'm currently having two master pages M1 and M2 and several content pages.
M2 has a calendar control and I want to call a content page function each time the selection on the calendar changes.
Here's the code I have in my master page:
public partial class Master2 : BaseMasterPage
{
public event EventHandler CalendarSelectionChanged;
public void Calendar_OnSelectionChanged(object sender, EventArgs e)
{
if (CalendarSelectionChanged != null)
CalendarSelectionChanged(this, EventArgs.Empty);
}
}
And here's the code in the content Page C1:
protected void Page_PreInit(object sender, EventArgs e)
{
Master.CalendarSelectionChanged += new EventHandler(OnMainCalendarSelectionChanged_SubContent);
}
private void OnMainCalendarSelectionChanged_SubContent(object sender, EventArgs e)
{
DoSomething();
}
but the CalendarSelectionChanged is always null and hence the function isn't called.