HowTo: Trap masterpage events... on the child Page

Aug 27 2007 2:23 PM

I have a masterpage that has an update button on it. When that button click evetn is fired I need to also need to trigger a second event on the child page. I need to update two seperate records using the same button click..

here is the code I have on the masterpage

    public delegate void UpdateButtonEventHandler(object sender, EventArgs e);

    public event UpdateButtonEventHandler UpdateButtonClick;

    protected void Page_Init(object sender, EventArgs e)
    {
        try
        {
            this.UpdateButtonClick += new UpdateButtonEventHandler(DoUpdateClick);

     ...}

    protected void btn_Update_Click(object sender, EventArgs e)
    {
        UpdateButtonClick(sender, e);
    }

    protected void DoUpdateClick(object sender, EventArgs e)
    {
        Response.Write("<script>alert('Master Fire')</script>");
    }

It works on the master page but I can not get it to also fire on the child page. I would much prefer to handle the firing on the masterpage in the btn_Update_Click all by it's self. and catch the tirggered evetn in the child page. ANY help would be GREATLY appreachiated...

 


Answers (1)