I'm trying to have a button that's clicked in the Site.Master page to fire a click event in the content page.
I understand that the Master-page actually turns into a child class on compilation.
I've tried several different solutions after a few hours of googling with no result in site.
Here is the current solution I have applied:
PageLoad()
{
Button btn = this.Master.FindControl("lbtnMaintenance") as Button;
btn.Click += new System.EventHandler(MasterlbtnMaintenance);
}
private void MasterlbtnMaintenance(object sender, EventArgs e)
{
MaintenanceHomeScreen(true);
}
//Created an Interface on .aspx page:
public interface ICommandable
{
void LblMaintenanceClick(object argument, EventArgs e);
}
public partial class Default : Page, ICommandable
{
public void LblMaintenanceClick(object sender, EventArgs e)
{
}
}
// On master page:
public void lbtnMaintenance_OnClick(object sender, EventArgs e)
{
if (Page is ICommandable)
{
(Page as ICommandable).LblMaintenanceClick(sender, e);
}
else
throw new NotImplementedException("u NO WURK");
}