.NET Interview Questions
.Net Interview Questions
Use the event to make final changes to the contents of the page or its controls
before the rendering stage begins.
Raised after each data bound control whose DataSourceID property is set calls its
DataBind method. For more information, see Data Binding Events for Data-
Bound Controls later in this topic.
Raised after view state and control state have been saved for the page and for all
controls. Any changes to the page or controls at this point affect rendering, but
the changes will not be retrieved on the next postback.
This is not an event; instead, at this stage of processing, the Page object calls this
method on each control. All ASP.NET Web server controls have a Render method
that writes out the control's markup to send to the browser.
If you create a custom control, you typically override this method to output the
control's markup. However, if your custom control incorporates only standard
ASP.NET Web server controls and no custom markup, you do not need to
override the Render method. For more information, see Developing Custom
ASP.NET Server Controls.
A user control (an .ascx file) automatically incorporates rendering, so you do not
need to explicitly render the control in code.
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
Although both Init and Load recursively occur on each control, they happen in reverse order. The Init
event (and also the Unload event) for each child control occur before the corresponding event is raised
for its container (bottom-up). However the Load event for a container occurs before the Load events for
its child controls (top-down). Master pages behave like child controls on a page: the master page Init
event occurs before the page Init and Load events, and the master page Load event occurs after the
page Init and Load events.
What is EnableViewStateMAC?
Setting EnableViewStateMac=true is a security measure that allows ASP.NET to ensure that the
viewstate for a page has not been tampered with. If on Postback, the ASP.NET framework detects that
there has been a change in the value of viewstate that was sent to the browser, it raises an error -
Validation of viewstate MAC failed.
P a g e | 4
Prepared by Abhishek Goenka
Email – firstname.lastname@example.org