Solved

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

Posted on 2011-02-20
3
536 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now