Saturday, June 4, 2011

What is the difference between Page_init and Page_Load event?

 This event is the first event to occur when an 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.

 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

Unlike Page_init, this event is loaded everytime when the page is postback.