473,387 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page_PreInit and Page_Load events (newby)

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

Dec 9 '05 #1
3 28035
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

Dec 9 '05 #2
Clinton:

Thanks very much for your help!

Fortunatley this new project will be entirely 2.0!

Fred

clintonG wrote:
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



Dec 10 '05 #3
Pay it forward :-)

<%= Clinton Gallagher

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:Ou**************@TK2MSFTNGP11.phx.gbl...
Clinton:

Thanks very much for your help!

Fortunatley this new project will be entirely 2.0!

Fred

clintonG wrote:
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
>


Dec 10 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: A.M | last post by:
Hi, Why the Page_Load events always triggers twice? Thanks, Ali
1
by: John Cosmas | last post by:
I have a login form which I will redirect to another page which will have to display a clock gif which rotates as long as the backend events are running while I load my profiles. Until then, I...
5
by: Alex | last post by:
We have a web site which we need to implement auditing. I've implemented a base form which all code behind files inherit from, and I can add the logic to it, but that would mean that all existing...
4
by: tshad | last post by:
Is there a way to do put Page_loads on a page? I am trying to setup a Page_Load that just puts a persons name that is logged on at the top of a page the first time a page is loaded. In my...
12
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference,...
3
by: gellis99 | last post by:
I've searched several discussions on this topic and haven't been able to resolve my issue. I have a function I call within the page_load event of a page. This function makes a call to the...
2
by: brad | last post by:
Group, I'm using Visual Studio 2003 to create an ASP.NET 1.1 project which contains nested server user controls in order to create a tree-like hierarchy. The tree is a sort of question and...
1
by: =?Utf-8?B?TWlrZXkgQmFieQ==?= | last post by:
Greetings Hopefully, I can be clear and concise on this one, but I'm confused. I have a page with a ListBox <- ODS <- BusinessObject and a button. The Parameter Source is 'None'. The Default...
1
by: epower | last post by:
Hello, I am working on an ASP .NET application in Visual Studio 2005 and running IE7. This application has a page that contains an iframe which loads an .aspx page and hyperlinks that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.