472,993 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 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 1583
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Diego | last post by:
Hi all I'd like to understand something about master pages: 1)Why if if try to typecast a masterpage inside a "child page" the compiler tells it dont find the class? I was trying to declare a...
7
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
14
by: multiformity | last post by:
So I have been working on an opensource project for a while, and decided to really try to make it look better after focusing on the functionality most of this time. Up to now, I have simply used a...
13
by: Michael | last post by:
I have setup a public variable in the Master Page "code-behind-file". Now I would like to set that value from the UserControl, but I can't seem to find a way to do this. Does anyone have any ideas?...
1
by: shapper | last post by:
Hello, I am creating a web site with Nested Master pages. I also need to have a class where the culture is set. When the culture is changed by the user the page refreshes and the change takes...
3
by: Rich | last post by:
Hi, I want to use 2 master pages, one for the main part of the site, the other for the admin pages. They are quite similar, with many shared elements. Ideally I would like to have a parent...
4
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null....
4
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase...
1
by: CideoEspada | last post by:
I have a problem with my child asp pages, They seem to not recognize Arabic characters and display them as gibberish, while on the master pages or pages that are independent from master pages they...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.