Monday, January 28, 2013

What is the difference between the Page_Init and Page_Load events?


The Page_Init event is the first to occur when an ASP.NET page is executed.This is where you perform any initialization steps that you need to set up or create instances of server controls.You can't access controls in this event because there is no guarantee that they have been created yet.
The Page_Init event fires only the first time the page is loaded.
When you postback to any page, the Page_Init event doesn't fire.

The Page_Load event fires each time the page loads, postback or not.

This event occurs only when all the objects on the page have been created and are available for use.

1 comment: