473,405 Members | 2,445 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,405 software developers and data experts.

What is the difference between Page_init and Page_Load event?

ad
Hi,
What is the difference between Page_init and Page_Load event?
Nov 19 '05 #1
6 1776
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
"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
ad
Thanks,
I have tried!
The Init event fired everytime when page is postback!
"Kannan.V [MCSD.net]" <Ka************@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D: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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Daniel Groh | last post by:
Hi, i'd like to know more abou this event, i tryed to found in MSDN but the explanation is null for me...is there some explanation when and how should i use it ?
9
by: wASP | last post by:
Hello again to all of you geniuses, I'm having a problem trying to load dynamic controls at the initialization phase. I've read the docs, and I thought I had it figured out:...
4
by: jack | last post by:
Hello, How should I use Page_init and Page_load with making ASP.NET Apps? Thanks, Jack
4
by: awalker1 | last post by:
Hi all, I have a datagrid and a drop down list on my page. The DataGrid is created dynamically at runtime to contain columns based on the item that the user has selected from the drop down...
5
by: Jimmy | last post by:
Hi Can someone explain to me what the difference is between a PreRender event and the Page Load event for a webform? ch Jimmy
10
by: Wylbur via DotNetMonster.com | last post by:
Hello to all of you geniuses, I'm having a problem trying to get an Init handler to fire for a Placeholder control at the initialization phase. I’ve posted this problem to 3 other ASP.NET...
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,...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
20
by: Simon Says | last post by:
Hi, I've a login page in which after authenticating it via the Oracle DB, I will stored the user information into the Session. However, when the Session timeout occurs, all of the user...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.