Life Cycle of a page in ASP.NET 2.0 using VB.NET

Through this article you will understand the execution of the page on the server from the client side. You will also understand Events and Life Cycle of a page. ASP.NET 2.0 adds a few new events to allow you to follow the request processing more closely and precisely. These new events are discussed in this article.
  • 1645

Introduction

Understanding Page Life Cycle is very crucial in order to develop ASP.NET applications. Most beginners tend to get confused while dealing with dynamic controls and face problems like losing values, state etc on postbacks. Since HTTP is stateless, the nature of web programming is inherently different from windows application development, and the Page Life Cycle is one of the primary building blocks while learning ASP.NET. The sequence of events, especially while working with MasterPages in ASP.NET 2.0, has become slightly more complex.

Events and Life Cycle of a Page (ASP.Net 1.x VS ASP.Net 2.0)

In the ASP.NET runtime the Life Cycle of a page is marked by a series of events. In ASP.NET 1.x, based on user interaction a page request is sent to the Web server. The event that is initiated by the page request is Init. After the Init event, Load event is raised. Following the Load event, PreRender event is raised. Finally, the Unload event is raised and an output page is returned to the client.

ASP.NET 2.0 adds a few new events to allow you to follow the request processing more closely and precisely.

These new events are discussed as follows:

Events Description:

There are the following events of Life Cycle.

 

  • PreInit
  • InitComplete
  • PreLoad
  • LoadComplete
  • PreRenderComplete

 

PreInit:

 

 

This occurs before the page begins initialization. This is the first event in the Life Cycle of an ASP.NET 2.0 page.

 

InitComplete:

 

This occurs when the page initialization is completed.

 

PreLoad:

 

This occurs immediately after initialization and before the page begins loading the state information.

 

LoadComplete:

 

This occurs at the end of the load stage of the page's Life Cycle.

 

PreRenderComplete:

         

This occurs when the pre-rendering phase is complete and all child controls have been created. After this event, the personalization data and the view state are saved and the page renders to HTML.

This new features enable developer to dynamically modify the page output and the state of constituent controls by handling these events.

Note: In ASP 2.0 we don't need to install IIS in your system. It comes with built-in ASP server.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.