Difference between Page_Load and Page_Init?

  • Thread starter Thread starter RajW
  • Start date Start date
R

RajW

In ASP.NET VB, what is the difference between "Page_Load" and
"Page_Init"?

Thanks,
/*Raj*/
 
PAGE_INIT

The Page_Init event is the first to occur when an ASP.NET page is executed.
This is where you should perform any initialization steps that you need to
set up or create instances of server controls. You don't want to try to
access controls in this event because there is no guarantee that they have
been created yet. It is during this event that they are created, and you can
control whether your attempt to use these objects will be thwarted by the
server processing your request before the object has been created.

Note that the Page_Init event fires only the first time the page is loaded.
When you use a web form and post back to this page again, the Page_Init
event doesn't fire. But the Page_Load event fires each time the page loads.

PAGE_LOAD

This is the page event where you will be doing most of your work. This event
occurs only when all the objects on the page have been created and are
available for use.

HTH,

Raymond Lewallen
 
Back
Top