ASP.net Interview questions


Q) In what order do the events of an ASPX page execute. As a developer is it important to undertsand these events?  INIT, PageLoad, Prerender , UNload.

Q) 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 view state is not fully loaded during this event

Q) What is AutoPostBack?  If you want a control to postback automatically when an event is raised, you need to set the AutoPostBackproperty of the control to True.

Q) Suppose you want an ASP.NET function (client side) executed on the MouseOver event of a button. Where do you add an event handler?  The event handler is added to the Add() method of the Attributes property.

Q) How can you implement the postback property of an ASP.NET control?  You need to set the AutoPostBack property to True to implement the PostBack property of controls.

Q) What are the event handlers that can be included in the Global.asax file?  The Global.asax file contains some of the following important event handlers:

  • Application_Error
  • Application_Start
  • Application_End
  • Session_Start
  • Session_End

Q) When we execute a Web page, it passes from the following stages, which are collectively known as Web page lifecycle:

Ans:

  • Page request – During this stage, ASP.NET makes sure the page either parsed or compiled and a cached version of the page can be sent in response
  • Start – During this stage sets the Request and Response page properties and the page check the page request is either a postback or a new request
  • Page Initialization – During this stage, the page initialize and the control’s Unique Id property are set
  • Load – During this stage, if the request is postback, the control properties are loaded without loading the view state and control state otherwise loads the view state
  • Validation – During this stage, the controls are validated
  • Postback event handling – During this stage, if the request is a postback, handles the event
  • Rendering – During this stage, the page invokes the Render method to each control for return the output
  • Unload – During this stage, when the page is completely rendered and sent to the client, the page is unloaded.

What’s the use of Response.Output.Write()? We can write formatted output  using Response.Output.Write().

List the events in page life cycle.
  1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8)Render
Differentiate strong typing and weak typing
In strong typing, the data types of variable are checked at compile time. On the other hand, in case of weak typing the variable data types are checked at runtime. In case of strong typing, there is no chance of compilation error. Scripts use weak typing and hence issues arises at runtime.
List all templates of the Repeater control.
  • ItemTemplate
  • AlternatingltemTemplate
  • SeparatorTemplate
  • HeaderTemplate
  • FooterTemplate
What are the components of ADO.NET?
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.

What is the difference between ExecuteScalar and ExecuteNonQuery?

ExecuteScalar returns output value where as ExecuteNonQuery does not return any value but the number of rows affected by the query. ExecuteScalar used for fetching a single value and ExecuteNonQuery used to execute Insert and Update statements.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: