Within each stage of the life cycle of a page, the page raises events that you can handle to run your own code which are listed below:
1) PreInit: It is raised before the initialization stage begins. If you want to change master page or themes dynamically, then you have to use this event.
2) Init: It is raised after all controls have been initialized. If you want to read or initialize control properties, then you have to use this event.
3) InitComplete: It is raised at the end of the page's initialization stage. If you want to make changes to view state that you want to make sure are persisted after the next postback.
4) PreLoad: It is raised after the page loads view state for itself and all controls. It processes postback data that is included with the Request instance.
5) Load: It is raised after the preload event. If you want to set properties in controls and to establish database connections, then you have to use this event.
6) LoadComplete: It is raised at the end of the event-handling stage. If you want to do tasks that require all other controls on the page be loaded, then you have to use this event.
7) PreRender: It is raised after the Page object has created all controls that are required in order to render the page, including child controls of composite controls. If you want to make final changes to the contents of the page or its controls before the rendering stage begins, then you have to use this event.
8) PreRenderComplete: It is raised after each data bound control calls its DataBind() method.
9) SaveStateComplete: It is raised after view state and control state have been saved for the page and for all controls. If you make any changes to the page or controls at this point, it affect rendering, but the changes will not be retrieved on the next postback.
10) Unload: It is raised for each control and then for the page. If you want to do final cleanup for specific controls, such as closing control-specific database connections.
No comments:
Post a Comment