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

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.
LVL 1
cjrbusAsked:
Who is Participating?
 
Dale BurrellConnect With a Mentor DirectorCommented:
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
 
cjrbusAuthor Commented:
Thank you we just used delegates... but this does answer my question
0
 
cjrbusAuthor Commented:
thanks!
0
All Courses

From novice to tech pro — start learning today.