In a page life cycle it is important to understand the stages of the life cycle in order to write the proper coding at the proper stage of the page life cycle.

It performs a series of processing steps

  • · Initialization
  • · Initiating controls
  • · Restoring
  • · Maintain state
  • · Running event handlers
  • · Rendering.

Stages of the page life cycle:-

Page request – User request a web page and it passed to the server and the server determines whether the page need to be compiled and send or cached version can be invoked instead compilation.

Start – Page properties are set and determine whether it is a post back or not. Some of the properties are as follows

· Request

· Response

· IsPostBack

· UICulture

Page initialization– All the controls are available to and the unique id property is also set during this stage. All the themes are applied here; View state values will be yet to be loaded by this stage. So there will be no data on the page.

Load -Properties of all the controls and the data from the view state are being loaded during this stage. This stage can be used for the data binding of the page.

Validation -The validate methods of the validater controls are being called and all the validation are checked, while the isvalid property is being set.

Postback event handling – any the event handlers are being called.

Rendering Page render method for each of the controls are being called, which provides a text writer to the output stream of the page in response.

Unload This is called after the page if being rendered and all the writers are sent to the client. All The response and request are unloaded and the cleanup is performed.

refernce:-msdn

Advertisements