What are the methods fired during the page load? Explain each of them.Init() :
- When the page is instantiated. - Raised after all controls have been initialized and any skin settings have been applied. - The Init event of individual controls occurs before the Init event of the page. - Use this event to read or initialize control properties.
Load() :
- When the page is loaded into server memory. - The Page object calls the OnLoad method on the Page object, and then recursively does the same for each child control until the page and all controls are loaded. - The Load event of individual controls occurs after the Load event of the page. - Use the OnLoad event method to set properties in controls and to establish database connections.
PreRender() :
- The brief moment before the page is displayed to the user as HTML. - Raised after the Page object has created all controls that are required in order to render the page, including child controls of composite controls. - The Page object raises the PreRender event on the Page object, and then recursively does the same for each child control. - The PreRender event of individual controls occurs after the PreRender event of the page. - Use the event to make final changes to the contents of the page or its controls before the rendering stage begins.
Unload() :
- When page finishes loading. Raised for each control and then for the page. - In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections. - For the page itself, use this event to do final cleanup work, such as closing open files and database connections, or finishing up logging or other request-specific tasks.
|