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

What role “#&&” plays in a querysting?

# works as a fragment delimeter in a querysting. With which you can delimit history state.
While && preceeds, state information in query string.
what is Ajax?

Ajax is asynchronous JavaScript and can use only those control in your page that post back to server can avid UN usable control that can every time auto post back to server side.Ajax is time consuming .

ex.In your web form 5 control only you have 2 control can auto post back every time at server side. you can add that control in update panel.
Name the property of ScriptManager which is used to change the timeout for the script execution?

NOTE: This is objective type question, Please click question title for correct answer.
Which of these classes is responsible for partial page Updates in browser ?

NOTE: This is objective type question, Please click question title for correct answer.
What is the name of the dll that contains the Ajax Control Toolkit?

AjaxControlToolkit.dll is the name of the dll. It has to be downloaded from the internet. To use it in your web site,

Tools->Choose ToolBox Items--> select the AjaxControlToolkit.dll Click OK->

Tools will be added in the toolbox.

It is also copied in the Bin Folder.
How to control the duration of an AJAX request?

It is controlled using the AsyncPostBackTimeout property of the ScriptManager

<asp:ScriptManager runat="server" id="ss" AsyncPostBackTimeout="50"/>

AsyncPostBackTimeout value is in seconds (so it is 50 seconds) , before asynchronous postback times out if no response is received.
default value is 90 seconds.
how can we detect asynchronous partial page postbacks?

Use the IsInAsyncPostBack property of the ScriptManager .
It returns a boolean value that can be used to check for partial page postbacks.

Partial Page PostBack:
It is the mechanism through which a particular area of a web page is updated when
some postback occurs.The whole page is not updated when the postback
occurs. It results in performance improvement.

AJAX Technology provides us with a Control known as UpdatePanel which is used for partial page postbacks.
example: if we place a button and a Label inside UpdatePanel, and write code to display some text on the Label, the whole page will not be posted and updated.
The indicator progressbar in the browser statusbar will not be visible in this case.
which of these client side events is not raised during async postback?

NOTE: This is objective type question, Please click question title for correct answer.
What are the disadvantages of AJAX?

These are the disadvantages:

1) AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS,your AJAX functionality may not work.
2) Search engines generally do not index Javascript present in web pages. AJAX can be problematic in Search engines as it uses Javascript for most of its parts.
3) source code written for AJAX is easily human readable.
4) Debugging is difficult. We have often to use additional Javascript code for that.
5) Data of all requests is URL-encoded. It increases the size of the request. It can cause problem while Paginating through GridView if there is a huge data.
6)Slow and unreliable network connection.
7)Problem with browser back button when using AJAX enabled pages.
Can we access the controls at server side (ASP.NET) which are outside of the update panel whenever update panel sends a post back request to the server?

Yes, We can access the controls which are outside of the update panel whenever update panel post back to the server. We can also change the data of those controls however it will not reflect at client side(or browser) because the AJAX call will only refresh/return the data within update panel.
What is update panel?

Update panel is a server control. It is used to update specified portion of a web page. To use update panel, we need to use a script manager.

in aspx page

<asp:ScriptManager ID="scriptManger1" runat="server">

<asp:UpdatePanel ID="updKpf" runat="server">
<%-- add controls here which you want not to post back during updation--%>

What is the limitation with update panel?

Using update panel, you can not validate outside controls.
there is a grid in update panel.
and you want to validate grids field. having button outside the update panel.
validation will be executed but not affect to the page due to update panel. so to solve this kind of problems, we have place button in another update panel also.
What is PageMethod in ASP.Net AJAX?

PageMethods of ASP.NET AJAX are used to call server side code in client side code. PageMethods are implemented in code behind file. These are public static methods and are annoted with [WebMethod] attribute.


public static string function1(string param1)
return "success";

These page methods are renderd as inline javascript and called by a client side code.

Call function1 using PageMethods in javascript file.


function OnSuccess(val)
//fetch returned value on success.
alert("Succcessfully done.");
return true;

function OnFail()
alert("Some error occurred during called page method: function1.");
return false;

Which two methods are used for handling Cross-Domain Ajax Calls ?

Cross-domain means the ability to manually or automatically access or transfer data between two or more differing security domain

1) CROS (Cross-Origin Resource Sharing) : Works with all HTTP verbs and Mos modern web browsers. Provides better support for error handling than JSONP.

2) JSONP (JSON with padding) : It is only works HTTP GET verb and on legacy browsers.

ASP.NET AJAX is the free Microsoft AJAX framework for building highly interactive and responsive web applications that work across all popular browsers. The ASP.NET AJAX framework includes Server-Side ASP.NET AJAX, Client-Side ASP.NET AJAX, the AJAX Control Toolkit, and the jQuery library. ASP.NET AJAX enables developers to choose their preferred method of AJAX development, whether it is server-side programming, client-side programming, or a combination of both.
can we use script manager in .aspx page if it is already inheriting the master page which includes script manager?

No, we can not use the script manager in the .aspx page as it is already present in the master page.
Which property should we have to fire Timer event at defined time-interval?

We have to set Interval property of Timer to fire its event.
Interval property has Milliseconds values like 1000 ms = 1 second.

Timer1.Interval = 2000;

Then after every 2 second,it's events will be fired.
What is the use of Update() method in UpdatePanel Control?

UpdatePanel'Update() method is used to update associated updatepanel content.It will we only used when updatepanel UpdateMode is set to Conditional.We write updatemethod() in any method or events in code-behind whenever we want to update updatepanel content.
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