(8)PreRender Allows final changes to the page or its control. This event takes place after all regular PostBack events have taken place. This event takes place before saving ViewState, so any changes made here are saved.For example : After this event, you cannot change any property of a button or change any viewstate value. Because, after this event, SaveStateComplete and Render events are called.

EXAMPLE : Override the event as given below in your code-behind cs file of your aspx page

protected  override void OnPreRender(EventArgs e)

{
//  Each data bound control whose DataSourceID property is set calls its DataBind  method.
//  The PreRender event occurs for each control on the page. Use the event to make  final changes to the contents of the page or its controls.
}

(9)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.

EXAMPLE : Override the event as given below in your code-behind cs file of your aspx page

protected  override void OnSaveStateComplete(EventArgs e)

{//  Before this event occurs,  ViewState has been saved for the page and for all  controls. Any changes to the page or controls at this point will be  ignored.
//  Use this event perform tasks that require view state to be saved, but that do  not make any changes to controls.
}

(10)Render This is a method of the page object and its controls (and 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 necessary to properly display a control at the browser.

Note: Right click on the web page displayed at client’s browser and view the Page’s Source. You will not find any aspx server control in the code. Because all aspx controls are converted to their respective HTML representation. Browser is capable of displaying HTML and client side scripts.

EXAMPLE : Override the event as given below in your code-behind cs file of your aspx page

// Render stage goes here. This is not an event


Similar Topics:

Tags:

asp net page life cycle events with exampleasp net page life cycle with examplepage life cycle in asp net with exampleasp net page life cycle in detailasp net life cycle in detailasp net page life cycle examplepagelife cycle in asp net with examplepage life cycle in asp netasp net page life cycle with examplespage life cycle events in asp net with examples