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

What are the Good Steps to be followed for maintaining Connection Strings in Asp.Net Web Applications ?

There are some basic steps which should be followed inorder maintain Connection strings more efficiently they are

. Connection strings should allways be given in web.config file itself for security resons. Not only for security but also as more accessible at multiple places.

. We should never make connection strings as Declarative property for SqlDataSource control

. Allways Connection strings should be stored in an Encrypted format for secure Database server .

. Do not store it in a plain text format and also never store it in a .aspx page.
What do we Understand by the word "THEME" in asp.net ?

Theme is a group of property settings that allows to define the look and feel of the controls to be consistent through out the Web Application .

One of the advantage with themes is unlike CSS we can even Design server side controls like for example Treeview the style of rendering elements into the browser can be changed as per our wish.

Here we can even change entire Web Application look and feel by just changing the theme properties.

Hence these Themes could be very much useful for UI development of a web application
What is the main difference between DataSet.Clone() and DataSet.Copy() ?

Generally

DataSet.Clone() would copy only the schema of the DataSet object and it would return the DataSet object that has same struture that the previous dataset object which includes all the relations, constraints and schemas as well. This will not copy the data from the existing one to new one.

The existing Dataset ---

private DataSet CreateMyClone(DataSet myCloneDataSet) 

{
DataSet exampleCloneDS;
exampleCloneDS = myCloneDataSet.Clone();
return exampleCloneDS;
}



DataSet.Copy() will copy complete code as well as the structure of the existing DataSet object.
What is Event Bubbling in asp.net ?

For every control in asp.net there are some pre defined events which could be handled for example let us take a button which has an OnClick() event when ever a single click is made to that button that event raises.

But if that particular button is in any of the following Server controls like GridView,Repeater,DataList etc .

We cannot retrieve the button onClick() event directly. For that let us consider we have the same button in GridView.

Here Button is the child control where as the parent control is our Gridview. These child controls do not raise by themselves when they are inside any server controls , they pass the event to the container parent and from then it is passed to our page as "ItemCommand". From the code behind we cann access button onclick event now with that ItemCommand Event of Parent control.

This process of sending the child control events to parent control is said to be
Event Bubbling
Difference Between Web.Config file and Global.asax ?

Web.Config file is used ....

1. To specify the application settings
2. To specify the session mechanism available to use for that application.
3. To Specify the Connection strings.
4. To Specify the authentication and authorization.
5. To Specify the http handlers.
6. To Specify different providers.

Global.asax file is used to specify the session and application event handlers.
What is Data Source Control with example?

With the help of Data Source Control, we can perform the data binding operation by writing some data access code. This is used to retrive a DataReader or a DataSet object from the server and you can show that retrived data in DataGrid, DropDownLIst or in ListBox.

Example:
SqlConnection con = new SqlConnection();

SqlCommand cmd = new SqlCommand("Select * from Emp", con);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();
da.Fill(ds);

GridView1.DataSource = ds;
GridView1.DataBind();

Which of these cannot be determined using the Request.Browser property ?

NOTE: This is objective type question, Please click question title for correct answer.
Which of these files affects the settings of Windows as well as web applications?

NOTE: This is objective type question, Please click question title for correct answer.
Which of these is a virtual file?

NOTE: This is objective type question, Please click question title for correct answer.
Which of these Controls supports the Bind method?

NOTE: This is objective type question, Please click question title for correct answer.
Which event is fired when any button is Clicked in a GridView

NOTE: This is objective type question, Please click question title for correct answer.
How to change the CssClass of a server control without writing any code for checking the browser?

Here is a example

<asp:Label Id="Label1" ie:CssClass="ieClass" mozilla:CssClass="mozClass" />

Open in the different browser and see the difference .
Which of these is a valid declaration in a skin file ?

NOTE: This is objective type question, Please click question title for correct answer.
What is the difference between Eval and Bind methods?

Both Eval and Bind apply to the templated controls like the GridView, FormsView.

But there are certain differences

1)Eval method:
a)It supports only one way binding. It means that we can only read data from the
column using Eval method.
b)It does not need the ID of a particular control
example:
<table>
<tr>
<td><%#Eval("productname")%> </td>
</tr>
</table>
is OK.
c)It applies to controls like the GridView, DataList, Repeater, ListView, FormsView, DetailsView.

1)Bind method:
a)It supports two way binding. It means that we can read data and modify data using the Bind method.
b)It always needs the ID of a particular control
example:
<table>
<tr>
<td><%#Bind("productname")%> </td>
</tr>
</table>
is WRONG
we have to take some UI control like Label aand specify the Binding in the
Text property.
c)It applies to controls like the GridView, FormsView, DetailsView.
Which mode should be used to maintain session state even if the Web Server crashes?

NOTE: This is objective type question, Please click question title for correct answer.
Which of these controls is supported for pagination by DataPager ?

NOTE: This is objective type question, Please click question title for correct answer.
A web user control has been created in WebSite1. Can we use it in WebSite2, WebSite3 etc.

Yes, you can use it in WebSite2, WebSite3

To use it in WebSite2

1)Go to the Solution explorer.

2)Click the root folder.

3)Right Click-->Add Existing Item

4)Add the web user control(.ascx and .ascx.cs files)

5)Drag and drop it on whichever .aspx webform you want.
You have developed a job website using ASP.NET. What must the end users should have on their PC'S to view or register at the web site.

The end users need to have only the web browser.
This because ASP.NET needs only a browser at the client end to view/register at the
web site.
On the server machine, .net framework, web server and the database server should
be installed.Web browser may be needed at the server machine if some testing is
to be done.
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