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("");
}
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...
David JohnsonPosted Aug 27, 2007, 2:47 PM
Figured out the ANSWER..
On the Master page Get rid of all the crud and use the native click event
protected void btn_Update_Click(object sender, EventArgs e)
{
Response.Write("");
}
Then add the followign Code to the child Page...
public partial class Detail : System.Web.UI.Page
{
Button UpdateButton =new Button();
public void DoUpdates(object sender, EventArgs e)
{
Response.Write("");
}
protected void Page_Init(object sender, EventArgs e)
{
UpdateButton = (Button)(Master.FindControl("btn_Update"));
UpdateButton.Click += new EventHandler(DoUpdates);
}
}
Now I get both alert windows with the single Click