Solved

How do I run masterpage pageload before child pageload (i want to access datamembers)

Posted on 2011-02-20
3
583 Views
Last Modified: 2012-05-11
In our ASP.NET project, we have a master page which constructs certain objects in its Page_Load method.

We have another page that uses this Master page as its master page, which requires the objects constructed in the Page_Load method of the master page.

We have performed experiments which indicate that the Page_Load method of the child is being run before the Page_Load of the master page.

How would you recommend accessing those datamembers?

Note: Constructing the desired objects in the constructor of the master page is not an option, because we require data passed into Page_Load.
0
Comment
Question by:cjrbus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 500 total points
ID: 34939165
Master pages are actually controls from the point of view of the page lifecycle and consequently are loaded by the page during the page load event as with any other controls.

So loading stuff in the masterpage that is required by the page isn't really the correct way to do it.

That said if you really have no choice about the matter then create an event in your master page that you fire once the data is loaded, and register an event handler in the page which will receive this event notification and know that the data is loaded and available to be accessed.
0
 
LVL 1

Author Comment

by:cjrbus
ID: 34939282
Thank you we just used delegates... but this does answer my question
0
 
LVL 1

Author Closing Comment

by:cjrbus
ID: 34939284
thanks!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question