ASP.NET AJAX Interview Questions and Answers (61) - Page 3

What is the use of Conditional UpdateMode property?

If we are working with Updatepanel in ASP.Net,then we must use UpdateMode property.
When we do not want Updatepanel to update its content everytime when any event is raised,then we have to set UpdateMode property to Conditional.
So that, associated updatepanel content will not get refreshed everytime.
We have to call Update() method of updatepanel control in code-behind if updatemode is set to Conditional.

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"></asp:UpdatePanel>

What is the purpose of Always UpdateMode property of an Updatepanel control?

If we are working with Updatepanel in ASP.Net,then we must use UpdateMode property.
If the UpdateMode property is set to Always,the UpdatePanel control’s content will get refreshed on every postback meaning that if we set UpdateMode to Always then if any events viz. button click,dropdownlist selectedindexchanged event occurs then the content of an updatepanel control is refreshed.Therefore it causes the page performance,because page is refreshing everytime.Therefore we have to avoid page refresh,thatswhy we have to set updatemode property to Conditional.

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"></asp:UpdatePanel>

What is the default value set for UpdateMode property of updatepanel control?

Default value of UpdateMode property OF UPDATEPANEL CONTROL is ALWAYS.
Which value will UpdateMode property take if we do not define or set UpdateMode property in UpdatePanel definition?

UpdateMode property will set value as Always ,if we do not define or set UpdateMode property in UpdatePanel definition.Because Always is a by-default value of updaemode property.
What will happen,when we set UpdateMode property of update panel control to Always and call its Update() method in code-behind?

It will throw a run-time exception saying that

The Update method can only be called on UpdatePanel with ID 'UpdatePanel1' when UpdateMode is set to Conditional.

Where UpdatePanel1 is our UpdatePanel Id.

Meaning that we can only call Update() method when UpdateMode property is set to Conditional in Updatepanel definition.
Why we use AJAX in Asp.Net application?

AJAX is used for updating portion of a web page without reloading or refreshing the whole page.
AJAX consists of an Asynchronous JavaScript and XML meaning that it uses Javascript for client side operations to avoid page refreshing.It alse uses XMLHttpRequest object which is used to communicate with servr-side scripts.

In short,we can say that AJAX is used for avoiding full page postback.
Why AJAX is Asynchronous in Nature?

AJAX has Asynchronous behavior,which states that AJAX can perform all the operations without refreshing the whole page.Meaning that it updates only a portion of a page.
What are the Technologies Used in AJAX?

AJAX uses Technologies like Javascript for client-side operations,DOM(Document Object Model) for representing the structure of XML and HTML documents,CSS(Cascading Style Sheets) for designing Page layouts and XMLHttpRequest for communication with the server.
What is Scriptmanager control in Asp.Net?

ScriptManager Control is a Server-Side Control and the most important and widely used control in AJAX.It uses Client-Side script to work with all the server side controls.
ScriptManager control by-default registers the script for the Microsoft AJAX Library with the page.This makes enable to use partial page rendering/partial page postback.
For working with AJAX,we must give reference of ScriptManager after <body> tag on the page like below:-

<asp:ScriptManager ID="scm" runat="server"></asp:ScriptManager>

Note:- We can have only one Scriptmanage Control on to a Page at a time.

It's a class as well as Control.

What is Difference between ScriptManager and ScriptManagerProxy control in AJAX?

ScriptManager is a server control that makes script resources available to the browser,including the Microsoft AJAX Library and the functionality that enables partial-page rendering.

Whereas ScriptManagerProxy is also a server control that enables nested components to add script and service references if the page already contains a ScriptManager control.
Where is the best place to put ScriptManager control on a page?

If we have Master page on our Web Application,so put scriptmanager control on master page.Because all the content page will inherit master page.So even if we do not put script manager on content

page and directly put update panel,then it will work.
What will happen when we have more than one ScriptManager Control on to the same page or one is on Master Page and another one is on Content Page?

We can not have more than one ScriptManager Control on to the same page because AJAX does not allow to do.If we put more than one ScriptManager Control on to the same page,then it will give below error at the time of loading page:

Only one instance of a ScriptManager can be added to the page.

Above message clearly stating that only one instatnce of ScriptManager means we can keep only one ScriptManager control on a page.
Lists mostly used Scriptmanager properties?

Mostly used Scriptmanager properties are:- Id,EnablePageMethods,EnablePartialRendering,AsyncPostBackTimeout,EnableViewState
Listdown the basic controls which comes under AJAX?

ScriptManager,Timer,UpdatePanel,UpdateProgress,ScriptManagerProxy are the controls which comes under AJAX.
What is the use of ScriptmanagerProxy class in AJAX?

As we know that,we can have only one ScriptManager control on to a Page.But if we have a scenario,that we have to register any script or use any web service in a particular page(content page) and ScriptManager is already there in a master page,then we can use the ScriptManagerProxy control to add scripts or give reference of web service to any content pages.Because if we give reference or add script in a master page,then every-time it will be referencing or adding from any page which is inheriting master page.
In which Assembly,ScriptManager class is defined?

Scriptmanager class is defined in System.Web.Extensions.dll .
We can find this dll in our system Global Assembly Cache(GAC) at C:\Windows\Assembly folder in Windows XP operating System.
How to use multiple ScriptManager controls in the Aspx Page?

A page can contain only ONE ScriptManager control on a page, we can not have Multiple ScriptManager controls on the page. if we need we can have ScriptManagerproxy control to our content page and add more scripts.
What makes Ajax unique?

NOTE: This is objective type question, Please click question title for correct answer.
Which one of these technologies is NOT used in AJAX?

NOTE: This is objective type question, Please click question title for correct answer.
How to disable Enter key pressed inside TextBox to avoid submission or Postback in Asp.Net?

In textbox definition,we have to write below code on onkeydown event as:-
<asp:TextBox ID="txt_emp_first_name" 

runat="server" onkeydown = "return(event.keyCode!=13);"></asp:TextBox>

Here,13 is keyboard Enter button key code.
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