ASP NET Page Life Cycle Events with Example

928
asp net page life cycle with example

This article provides a brief explanation of the what is asp net page life cycle events with example, asp net application lifecycle and after that its events. Often in asp.net interviews, you are asked to explain the Lifecycle of ASP.NET Page during its first request, as well as during Postback.

What is ASP NET Page Life Cycle

When ASP.Net page is called, that goes through a particular life cycle. This is done before the response is sent to the user. There are a series of steps which are followed for the processing of a life cycle of asp net page.

These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering.

Following are the different stages of an ASP.NET page:

asp net page life cycle with example

  • Page Request
  • Start
  • Initialization
  • Load
  • PostBack Event Handling
  • Rendering
  • Unload

ASP NET Application Life Cycle

When an ASP.Net application runs, there are a series of steps which are carried out. These series of steps make up the lifecycle of the application.

Let’s look at the various stages of a typical asp net application lifecycle:-

asp net application life cycle

  1. Application Start
  2. Object Creation
  3. HttpApplication Creation
  4. Dispose
  5. Application End

ASP NET Page Life Cycle Events

Following are the page lifecycle events:

  • PreInit()
  • Init()
  • InitComplete()
  • PreLoad()
  • Load()
  • ControlEvents()
  • LoadComplete()
  • PreRender()
  • PreRenderComplete()
  • SaveStateComplete()
  • RenderComplete()
  • Unload()

asp net page life cycle

ASP NET Page Lifecycle with Example

Now for better understanding, let’s look at the life cycle of asp net page with an example:-

Output

  • When a page request sent to the web server initially.

asp net page life cycle events 1

  • Similarly, we will check On button’s click event

asp net page life cycle events 2

Conclusion
I hope you liked this article to understand asp net page life cycle, asp net application lifecycle, and its events. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

LEAVE A REPLY

Please enter your comment!
Please enter your name here