Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

13 Experts available now in Live!

Get 1:1 Help Now