Friday, 7 November 2014

ASP.NET PAGE LIFE CYCLE

1.) What is asp.net life cycle ? 
Life Cycle Events

PreInit

The properties like IsPostBack have been set at this time.

This event will be used when we want to:
 
1.     Set master page dynamically.


2.     Set theme dynamically.
3.     Read or set profile property values.
4.     This event is also preferred if want to create any dynamic controls.
Init
1.     Raised after all the controls have been initialized with their default values and any skin settings have been applied.
2.     Fired for individual controls first and then for page.
LoadViewState
1.     Fires only if IsPostBack is true.
2.     Values stored in HiddenField with id as _ViewState decoded and stored into corresponding controls.
LoadPostData

Some controls like:
1.     Fires only if IsPostBack is true.
2.     Some controls like Textbox are implemented from IPostBackDataHandler and this fires only for such controls.
3.     In this event page processes postback data included in the request object pass it to the respective controls.
PreLoad
·  Used only if want to inject logic before actual page load starts.
Load

·  Used normally to perform tasks which are common to all requests, such as setting up a database query.

No comments:

Post a Comment

Type Script variables

Difference between var,let and const in java script and typescript -----------------------------------------------------------------------...