page life cycle

PreInit This is the first real event you might handle for a page. You usually use this event only if you need to set values such as master page or theme.This event is also useful when you are working with dynamically created controls for a page without a master page. You should create the controls inside this event.

Init This event fires after each control has been initialized. You can use this event to change initialization values for controls.If you need to dynamically add controls to a content page, use this event.

InitComplete This event is raised after all initializations of the page and its controls have been completed.

PreLoad This event fires before view state has been loaded for the page and its controls and before postback processing. This event is useful when you need to write code after the page is initialized but before the control view state has been re-established.

Load The page is stable at this time; it has been initialized and its state has been reconstructed. Code inside the page load event usually checks for postback and then sets control properties appropriately.The page’s load event is called first. Then the load event for each child control is called in turn (and then the load events for their child controls, if any). This is important to know if you are writing your own user or custom controls.

Control (postback) event(s)ASP.NET now calls any events on the page or its controls that caused the postback to occur. This might be a button’s click event, for example.

LoadComplete At this point all controls are loaded. If you need to do additional processing at this time, you can do so here.

PreRender This event allows final changes to the page or its control. It takes place after all regular postback events have taken place. This event takes place before ViewState is saved, so any changes made here are saved

SaveStateComplete Prior to this event, the view state for the page and its controls is set. Any changes to the page’s controls at this point or beyond are ignored. This event is useful if you need to write processing that requires the view state to be set.

Render This is a method of the page object and its controls (not an event). At this point, ASP.NET calls this method on each of the page’s controls to get its output. The Render method generates the client-side HTML, Dynamic Hypertext Markup Language (DHTML), and script that are neces-sary to properly display a control on the browser. This method is useful if you are writing your own custom control. You override this method to control output for the control.

Unload This event is used for cleanup code. You can use it to manually release resources, a process that is rarely necessary.