What is page life cycle in c#.net

Questions by bidyut_das

Showing Answers 1 - 15 of 15 Answers

Process Request Method does following things:

  1. Intialize the memory
  2. Load the view state
  3. Page execution and post back events
  4. Rendering HTML content
  5. Releasing the memory

Process Request Method executes set of events for page class .These are called as Page life cycle events.

Page Life Cycle Events

  • Page_Init
    The server controls are loaded and initialized from the Web form's view state. This is the first step in a Web form's life cycle.
  • Page_Load
    The server controls are loaded in the page object. View state information is available at this point, so this is where you put code to change control settings or display text on the page.
  • Page_PreRender
    The application is about to render the page object.
  • Page_Unload
    The page is unloaded from memory.
  • Page_Disposed
    The page object is released from memory. This is the last event in the life of a page object.
  • Page_Error
    An unhandled exception occurs.
  • Page_AbortTransaction
    A transaction is aborted.
  • Page_CommitTransaction
    A transaction is accepted.
  • Page_DataBinding
    A server control on the page binds to a data source. 
  • Process Request Method finally renders HTML Page


submitted by :
Rizwan Ashraf Ansari (NIIT South - Ex Delhi)

sd.rawat

  • Dec 29th, 2009
 

There are 10 different stages and methods in page life cycle

Stage - Method
1) Page Initialization - Page_Init
2) View State Loading - LoadViewState
3) PostBack data processing - LoadPostData
4) Page Loading - Page_Load
5) PostBack Chang - RaisePostDataChangedEvent
6) PostBack Event Handling - RaisePostBackEvent
7) Page Pre Rendering Phase - Page_PreRender
8) View State Saving - SaveViewState
9) Page Rendering - Page_Render
10) Page Unloading - Page_UnLoad




  Was this answer useful?  Yes

kirangiet

  • Jun 8th, 2010
 

Following are the events occur during ASP.NET Page Life Cycle:

1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Control Events
7) Page_LoadComplete
8) Page_PreRender
9) SaveViewState
10) Page_Render
11) Page_Unload

Among above events Page_Render is the only event which is raised by page. So we can't write code for this event.
Note: These event are not case sensitive. So we can write Page_Init as page_init in C#. Controls Events are the event raised when some action is performed on controls.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions