1. What is the sequence in which ASP.NET events are processed ?
Following is the sequence in which the events occur :
- Page_Init.
- Page_Load.
- Control events.
- Page_Unload event.
Page_Init event only occurs when first time the page is started, but Page_Load occurs in subsequent request of the page
asp-net
2. In which event are the controls fully loaded ?
Page_Load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that viewstate is not fully loaded during this event
3. How can we identify that the Page is PostBack?
Page object has a “IsPostBack” property which can be checked to know that is the page posted back.
4. How does ASP.NET maintain state in between subsequent request?
Refer caching chapter.
Caching Concepts
5. What is event bubbling?
Server controls like Datagrid, DataList, Repeater can have other child controls inside them. Example DataGrid can have combo box inside datagrid. These child controls do not raise their events by themselves, rather they pass the event to the container parent (which can be a DataGrid, DataList, Repeater), which passed to the page as “Item Command” event. As the child control send their events to parent this is termed as event bubbling.
How do we assign page specific attributes?
Page attributes are specified using the @Page directive.
6. If we want to make sure that no one has tampered with ViewState, how do we ensure it?
Set the @Page directive EnableViewStateMac to True.
7. What is the use of @Register directives?
@Register directive informs the compiler of any custom server control added to the page.
8. What is SmartNavigation property?
It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back. It is supported by Internet Explorer only.
10. What is AppSetting Section in “Web.Config” file ?
Web.config file defines configuration for a webproject. Using “AppSetting” section we can define user defined values. For Example we can define “ConnectionString” section which will be used throughout the project for database connection.
<configuration>
<appSettings>
<add key=”ConnectionString” value=”server=xyz;pwd=www;database=testing” />
</appSettings>