When does Page Load happen?

  • Thread starter Thread starter Ross
  • Start date Start date
R

Ross

I have an aspx page containing two IFrames, each of which
contain aspx pages. The mother page has a dataset filled
with a single call to my Oracle database. This dataset has
three tables. The mother page uses data from table1; the
first child page uses data from table2 and table3; the
last child page uses table3 only.
So the mother page's Page_Load fills the dataset and binds
to some controls. The child pages will use their Page_Load
methods to call a method on the mother page (getDataSet)
to obtain the data they need from the mother dataset.
Question: Does the Page_Load on the mother page finish
before the Page_Load on the children begin? Otherwise, the
call to getDataSet may throw some funky errors.
 
You have no guarantee at all on the order. In fact, it will depend on the
client's browser because it is the one that will issue the requests for the
two pages in the order that it wants.

In your case, I suggest that you use a call to the same method in the two
pages. The method will:
-load the data from the database and place it in the cache if it's not in
the cache, then return it
-return the data from the cache if it's already in.

That way you will have the same optimized effect without any dependence on
the order.
 
Yes... the Mother page's page load finishes and serves everything to the
browser and then the browser figures out the that there are IFrames and
generates additional requests for those content pages.

However, I don't believe that GetDataSet will work because the requests for
the IFrame pages are entirely independent requests and the server doesn't
know they are related to the mother page. Instead, you'll have to stash the
dataset in a session variable or some other more global storage.

charles
 
Question: Does the Page_Load on the mother page finish
before the Page_Load on the children begin? Otherwise, the
call to getDataSet may throw some funky errors.

These are asynchronous, unrelated HTTP requests, so there is no way to have
anything depend on when the Page_Load Sub of any of these pages will fire.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
Back
Top