Which of the following page events will be raised after the Page object has created all controls that
are required in order to render the page, including child controls of composite controls?
A.
PreRender
B.
Render
C.
SaveStateComplete
D.
PreRenderComplete
Explanation:
The Page.PreRender event is used for each and every control on a page. It is used to make ultimate
changes to the contents of the page or its controls. However, before this event occurs, the following
actions are performed:
The Page object calls the EnsureChildControls method for each and every control as well as for the
page.
Each data bound control calls its DataBind method if DataSourceID property is set.Answer D is incorrect. The Page.PreRenderComplete event occurs before the page content is
rendered. In other words, the PreRenderComplete event is raised when the pre-render stage of the
page life cycle is complete. At this stage, all controls are created, any pagination needed is
completed, and the page is all set to render to the output. The PreRenderComplete event is the last
event that occurs before the page’s view state is saved.Answer C is incorrect. The Page.SaveStateComplete event occurs after the View state and Control
state of a page and Controls on the page are saved to the persistence standard. The state
information for Controls on the page is saved after the PreRenderComplete event. It is the last event
raised before the page is rendered to the requesting browser.Answer B is incorrect. The Page.Render event is not an event instead it is a stage of processing. The
Page object calls the Page.Render method on each and every control. ASP.NET Web server controls
contain a Render method that writes out the control’s markup that is sent to the browser. A user
control (.ascx file) automatically includes rendering, therefore, no need to explicitly render the
control in code.