Always trust the official documentation [1-3]
Trust but always verify what you hear in the newsgroups.
The page life cycle was in fact somewhat different in 1.1 but controls still
have to be Init(ialized) by the Page class somehow. Its academic now that
2.0 is released and 2.0 is where you need to focus unless you intend to use
1.1 or support 1.1 applications.
In 2.0 the Page_Init event is always processed before the Page_Load event
whether you have code in the event or not as it is how all controls in the
page are Init(ialized) before the control tree is constructed.
As for your question about a test I would use the following in the Page_Load
event...
if(myIntValue != null)
{ // whatever }
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL
http://metromilwaukee.com/
URL
http://clintongallagher.metromilwaukee.com/
[1]
http://msdn2.microsoft.com/en-us/library/ms178472.aspx
[2]
http://msdn.microsoft.com/library/de.../internals.asp
[3]
http://msdn.microsoft.com/library/de...bjectmodel.asp
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi Folks:
I have a question about the Page_PreInit and Page_Load events in a web
application.
My question is: can I count on the Page_PreInit having completed before
the Page_Load event starts. (I recall that someone told me in VS2003
that you could not count it!)
I'm using C#.NET 2005 so if that was an issue in 2003, is it still an
issue?
I will be updating a static class in the Page_PreInit and using it in
the Page_Load so it will be important that the sequence is followed.
For example (using just an integer):
public static int myIntValue;
protected void Page_PreInit(..)
{
myIntValue = 1;
}
protected void Page_Load(..)
{
if (myIntValue == 1) ... etc.
}
Everything works fine in the "lab" however I want to be sure that when
the system is installed in a heavy load situation that it won't get
lost!
Also, if it is an issue and I test for a null value in Page_Load then
what would I do to continue to allow the page to load?
Thanks very much for your help!
Fred