Web form events available in ASP.NET?

The Web Form Events in the sequence of their execution –

  • Page_Init
    • First step in page life cycle.
    • This event will raise whenever page initialized.
    • All the controls in the page have been initialized.
    • This event can be used to read or initialize control properties.
  • Page_Load
    • This event occurs only after Page_Init event.
    • This event also will raise for every postback operation.
    • All control properties are loaded with information recovered from view state and control state.
  • Page_PreRender
    • Perform any updates before the output is rendered.
    • Any changes made to the state of the control in the prerender phase can be saved.
  • While changes made in the rendering phase are lost.
  • Page_PreRender is the last event you have a chance to handle prior to the page’s state being rendered into HTML.
  • Page_Unload
    • This event is used for cleanup code.
    • This event occurs for each control and then for the page.
    • Instances of classes, in other words objects.
    • Closing opened files.
    • Closing database connections.

Leave a Reply