Wednesday, May 14, 2008

ASP.Net general questions

Q1. What’ is the sequence in which ASP.NET events are processed ?
Ans - 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.

Q2. In which event are the controls fully loaded ?
Ans - During Page_load event all controls get fully loaded. Controls are also accessed in Page_Init events but you will see that viewstate is not fully loaded during this event.

Q3. How can we identify that the Page is PostBack ?
Ans - Page object has a "IsPostBack" property which can be checked to know that is the page posted back or not.

Q4. Where is ViewState information stored ?
Ans - Viewstate is stored in a HTML Hidden Field on the client side.

Q5. What is "AutoPostBack" feature in ASP.NET ?
Ans - If we want the control to automatically postback in case of any event, we will need to check this attribute as true. Example on a Dropdown change we need to send the event immediately to the server side then set the "AutoPostBack" attribute to true.

No comments: