Sunday, November 2, 2008

ASP.NET interview questions - 1

What is view state and use of it?The current property settings of an ASPNET page and those of any ASPNET server controls contained within the page. ASPNET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which allows you to program accordingly.

What are user controls and custom controls?Custom controls:A control authored by a user or a third-party software vendor that does not belong to the .NET Framework class library. This is a generic term that includes user controls. A custom server control is used in Web Forms (ASPNET pages). A custom client control is used in Windows Forms applications.
User Controls:In ASPNET: A user-authored server control that enables an ASPNET page to be re-used as a server control. An ASPNET user control is authored declaratively and persisted as a text file with an .ascx extension. The ASPNET page framework compiles a user control on the fly to a class that derives from the System.Web.UI.UserControl class.


What are the validation controls?A set of server controls included with ASPNET that test user input in HTML and Web server controls for programmer-defined requirements. Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.

What's the difference between Response.Write() andResponse.Output.Write()?The latter one allows you to write formattedoutput.


What methods are fired during the page load?

Init()When the page is instantiated, Load() - when the page is loaded into server memory,PreRender () - the brief moment before the page is displayed to the user as HTML, Unload() - when page finishes loading.

Where does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page

Where do you store the information about the user's locale?System.Web.UI.Page.Culture

What's the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?CodeBehind is relevant to Visual Studio.NET only.


What's a bubbled event?

When you have a complex control, likeDataGrid, writing an event processing routine for each object (cell, button,row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.Suppose you want a certain ASPNET function executed on MouseOver over a certain button.

Where do you add an event handler?

It's the Attributesproperty, the Add function inside that property. e.g. btnSubmit.Attributes.Add("onMouseOver","someClientCode();")


What data type does the RangeValidator control support?

Integer,String and Date.

No comments: