471,337 Members | 1,115 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Getting Master Page Events From Child Pages

I have a logout link in a master page...when the link is pressed I want
to capture that event in the child page, not the master page, becase
there is some processing I want to do in the child page...is there an
easy way to capture the "Handles LinkButtonLogout.Click" from the
child page?

Thanks, Ed,

Nov 19 '05 #1
2 1547
First, you’ll need to write a public method (property) in a master page:

public partial class MyMasterPage : System.Web.UI.MasterPage
{
public Button GetMyButton() { return Button1; }
}

Second, you’ll need to assign an event handler manually in a child page:

public partial class ChildPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
(Master as MyMasterPage).GetMyButton().Click += new
EventHandler(ChildPage_Click);
}
}

Alexey Borzenkov
"gencode" wrote:
I have a logout link in a master page...when the link is pressed I want
to capture that event in the child page, not the master page, becase
there is some processing I want to do in the child page...is there an
easy way to capture the "Handles LinkButtonLogout.Click" from the
child page?

Thanks, Ed,

Nov 19 '05 #2
Awesome...thanks, Ed,

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Diego | last post: by
7 posts views Thread by Martijn Saly | last post: by
1 post views Thread by shapper | last post: by
3 posts views Thread by Rich | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.