ASP.NET Interview Questions and Answers (1544) - Page 54

How many web sites can be hosted in one server?

A web server can host hundreds of web sites.Most of the small web sites in the Internets are shared on web servers.They are several web hosting companies who offer shared web hosting from a web hosting company,they will host your web site along with their web server along with several other web sites.

Ex Of web servers applications are:
1.IIS
2,Apache
How many web servers are needed for a web site?

There is only one web server are required for a web site.But large web sites like yahoo ,google,msn etc will have millions of visitors every minute one computer cannot process such huge data ,so they will have a hundreds of servers then it can give the fast response
In.Net which is the parent class to create all windows service?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following statement is correct regarding .exe and .dll

NOTE: This is objective type question, Please click question title for correct answer.
What is the difference between inline code and code behind in asp.net?

1. In Code Behind, the HTML and controls are in the .aspx file, and the code is in a separate .aspx.vb or .aspx.cs file.
In Single File, the code is in <script> blocks in the same .aspx file that contains the HTML and controls.
2. In Code Behind, the code for the page is compiled into a separate class from which the .aspx file derives.
In Single File, the .aspx file derives from the Page class.
3. In Code Behind, all project class files (without the .aspx file itself) are compiled into a .dll file, which is deployed to the server without any source code. When a request for the page is received, then an instance of the project .dll file is created and executed.
In Single File, When the page is deployed, the source code is deployed along with the Web Forms page, because it is physically in the .aspx file. However, you do not see the code, only the results are rendered when the page runs.
ASP .Net Page class, in which of them would you attach an event handler to an event published by a control on the web page?

NOTE: This is objective type question, Please click question title for correct answer.
Differentiate between a page theme and a global theme?

Page Theme:
Where as Page theme applies to a particular web pages of the project. It is stored inside a subfolder of the App_Themes folder.

Global Theme:
Where as Global theme applies to all the web applications on the web server. It is stored inside the Themes folder on a Web server.
What is BrowserSwarm ?

It is free testing development tool from Microsoft which helps developers to automate testing their java script frameworks (jquery,underscore.js)across different browsers.

It can works directly by connecting to your team’s code repository on GitHub.
How many ways of finding controls through Javascript?

There are following ways to find any controls using javascript :-

1). Simple page ->
var txt_name = document.getelementsbyid('txt_employee_name');

2). Content page ->
var txt_name = document.getelementsbyid('<%=txt_employee_name.ClientId%>');

3). With Ajax ->
var txt_name = $get('txt_employee_name');
Which Gridview events called first?

NOTE: This is objective type question, Please click question title for correct answer.
What is Gridview_SelectedIndexChanged and Gridview_RowCommand events in ASP.Net?

Gridview_SelectedIndexChanged -> For working with this event, we have to give CommandName = "Select" in Command/Link/Hyperlink/Image Button in ItemTemplate in Gridview.

Gridview_RowCommand -> For working with this event, we can give any name to CommandName property as CommandName = "View_Details" or CommandName = "Add_details" or we can give any name.

Aspx page will look like this:-

<asp:Gridview id="grid_employee" runat="server" AllowPaging="True" AutoGeneratedColumns = "False">

<Command>
<asp:TemplateField>
<ItemTemplate>
<asp:Button id="btn_select" runat="Server" CommandName="Select" Text="View"></asp:Button>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField>
<ItemTemplate>
<asp:Button id="btn_view" runat="Server" CommandName="View_Details" Text="View Details"></asp:Button>
</ItemTemplate>
</asp:TemplateField>
</Command>
</asp:Gridview>


For Selected-Index-Changed event, we can find controls by using gridview "SelectedRow" property as below:-

protected void grid_employee_SelectedIndexChanged(object sender,EventArgs e) 

{
Label lbl_name = (Label)grid_employee.SelectedRow .Findconrol("lbl_employee_name");
}


But for Row-Command event, we can find controls as

protected void grid_employee_RowCommand(object sender, GridViewCommandEventArgs e)

{
if(e.CommandName.ToLower.Equals("view_details".ToLower())
{
Label lbl_name = (Label)grid_employee.Rows[index] .Findconrol("lbl_employee_name");

//Here index will be Gridview row'index.
}
}

Gridview's SelectedRow property is used for which gridview' events for finding controls inside gridview?

NOTE: This is objective type question, Please click question title for correct answer.
How to find Gridview's Control in RowDataBound event?

NOTE: This is objective type question, Please click question title for correct answer.
Which CommandName property of Command Button,Link Button or Image Button is used to Select any Row(s) from Gridview?

NOTE: This is objective type question, Please click question title for correct answer.
How to get Gridview Selected Row-Index?

With the help of Container.DataItemIndex, we can get Gridview Slected Row index.

For Example:-

In the ItemTemplate of Gridview, we can write:-

<ItemTemplate>
<asp:Button Id="btn_row_index" CommandName="View_Details"
CommandArguments = '<%# Container.DataItemIndex %>' Text="View Details"></asp:Button>
</ItemTemplate>
Explain the various CommandName properties used in Gridview to perform various operations like Delete,Update and so on.

There are 5 most used CommandName properties used in Gridview to perform various operations:-

1). Update :- As the name implies, this commandname property is used for Updating any Gridview row.

2). Select :- As the name suggests, this property is used for Selection any gridview row.

3). Delete :- We can use this property for Deleting rows from Gridview.

4). Edit :- By using this event, we can Edit any row. After Editing, we can perform Update operation meaning Update CommandName will be used.
This Icon or Button will only be enabled after clicking on Edit icon/button.

5). Cancel :- We can Cancel any Gridview Rows which are being Edited. This Icon or Button will only be enabled after clicking on Edit icon.
Which Gridview event is used for Update operation?

NOTE: This is objective type question, Please click question title for correct answer.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories