By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,058 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,058 IT Pros & Developers. It's quick & easy.

What is the difference between Page_init and Page_Load event?

P: n/a
ad
Hi,
What is the difference between Page_init and Page_Load event?
Nov 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi,

Here is the difference........

Page_init
------------
This event is the first event to occur when an ASP.net page is executed,
this is the event where you should be performing any initialization steps
that you need to setup or create instances of server controls.
Its generally advised not to access controls in this event as there is no
guarantee of the controls been created at this stage, its in this event the
controls are actually created.
This event fires only the first time the page is loaded and from the next
time on a postback Page_init is not fired.

Page_load
-------------
This is the event where most of our work will be done, this event occurs
when all objects/controls on the page are created and will be available for
use.

Unlike Init, this event is loaded everytime when the page is posted back.

Hope this helps,
--
Kannan.V
Home : http://www.kannanv.com
Blog : http://kannanv.blogspot.com
Web : http://www.DotnetLounge.net

"Any one who has never made a mistake has never tried anything new" - Einstein
"ad" wrote:
Hi,
What is the difference between Page_init and Page_Load event?

Nov 19 '05 #2

P: n/a
"Kannan.V [MCSD.net]" <Ka************@discussions.microsoft.com> wrote in
message news:5F**********************************@microsof t.com...
Page_init
------------
This event fires only the first time the page is loaded and from the next
time on a postback Page_init is not fired.


Er...are you sure...?
Nov 19 '05 #3

P: n/a
ad
Thanks,
I have tried!
The Init event fired everytime when page is postback!
"Kannan.V [MCSD.net]" <Ka************@discussions.microsoft.com> glsD:5F********************************* *@microsoft.com...
Hi,

Here is the difference........

Page_init
------------
This event is the first event to occur when an ASP.net page is executed,
this is the event where you should be performing any initialization steps
that you need to setup or create instances of server controls.
Its generally advised not to access controls in this event as there is no
guarantee of the controls been created at this stage, its in this event
the
controls are actually created.
This event fires only the first time the page is loaded and from the next
time on a postback Page_init is not fired.

Page_load
-------------
This is the event where most of our work will be done, this event occurs
when all objects/controls on the page are created and will be available
for
use.

Unlike Init, this event is loaded everytime when the page is posted back.

Hope this helps,
--
Kannan.V
Home : http://www.kannanv.com
Blog : http://kannanv.blogspot.com
Web : http://www.DotnetLounge.net

"Any one who has never made a mistake has never tried anything new" -
Einstein
"ad" wrote:
Hi,
What is the difference between Page_init and Page_Load event?

Nov 19 '05 #4

P: n/a
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:et**************@tk2msftngp13.phx.gbl...
The Init event fired everytime when page is postback!


Yes - it seems to be a common misconception that it doesn't...
Nov 19 '05 #5

P: n/a
ooops.....soory for that piece of wrong information.
Thanks Mark for correcting me.
--
Kannan.V
Home : http://www.kannanv.com
Blog : http://kannanv.blogspot.com
Web : http://www.DotnetLounge.net

"Any one who has never made a mistake has never tried anything new" - Einstein
"Mark Rae" wrote:
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:et**************@tk2msftngp13.phx.gbl...
The Init event fired everytime when page is postback!


Yes - it seems to be a common misconception that it doesn't...

Nov 19 '05 #6

P: n/a
ad wrote:
Hi,
What is the difference between Page_init and Page_Load event?


http://msdn.microsoft.com/asp.net/de...ry/en-us/dnasp
p/html/aspnet-pageobjectmodel.asp

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.