Ajax interview questions and answers on advance and basic Ajax with example so this page for both freshers and experienced condidate
|Questions : 1||Who is Ajax ?|
|Questions : 2||What is advantage of Ajax|
|Answers : 2|| Basic advantage of Ajax is Bandwidth utilization means when we have more type of data on same page or use more included page , hence data is fetched without loading the page it's save memory also it is more interactive no any user want lose their information from that page , so the concentrate only on same page fastest where loading a page is difficult or more time consuming Ajax do best work So why in all modern website need concentration to use Ajax ,it is a Browser technology independent of web server software .
Like every thing advantage and disadvantage Ajax has too some disadvantage like
When we use Ajax it is difficult to return back page , when we click on back button we
Got first page(because same page is using for sending or fetching data but when we need just last use thing we could not able to seen last modified data they gone to starting point
And also need to more concentration because it is faster to implement but still it is very beneficial to us
|Questions : 3||How AJAX Work ?|
|Answer : 3||
1.XMLHttpRequest create object for browser like Firebox ,Muzilla, opera ,safari and other .
2>Internet explore use ActiveXObject
3>onreadystatechange henceActiveXObjectvar. readyState ==4 means response is ready to send and sent by server hence process complete there values like 1,2 ,3 means ,initialize ,in process etc ..
4.>object .status== 200 means status is ok other wise produce error404
5> for open a file or data use
|Questions : 4||Which property needs to be set for script manager control to extend the time before throwing time out expection if no response is received from the server?|
|Answer : 4||
|Questions : 5||Is it possible to use FileUpload control within the update panel?|
|Answer : 5||Yes, it's possible. But we need to use Postback triggers to upload the file.|
|Questions : 6||Is it compulsory to have Script manager on the page when you are using any control of ajax control tool kit?|
|Answer : 6||Yes. Page needs to have a script manager for ajax control tool kit controls to work.|
|Questions : 7||Which control you need to place on the page to show loading image?|
|Answer : 7||UpdateProgress|
|Questions : 8||What is the DisplayAfter property in UpdateProgress control?|
|Answer : 8||Displayafter property specifies after how many seconds the loading image needs to be displayed in ajax postback. It takes values in seconds.|
|Questions : 9||How many types of triggers are there in update panel?|
|Answer : 9||There are 2 types of triggers. 1. PostBackTrigger : It does a full postback. This is useful when any such control which placed within updatePanel but it cannot work asynchronously. Like File Upload Control. 2. AsyncPostBackTrigger :- It does partial post back asynchronously.|
|Questions : 10||If there are multiple update panels on the page say Upd1 and Upd2. There is a button placed in Upd1. How can you stop Upd2 to update when button placed in upd1 is clicked?|
|Answer : 10||There is a property called UpdateMode which takes two values 1.Always : Default value of this property. 2.Conditional When set to conditional, then that updatepanel's content only gets updated when control placed in that update panel does a postback. Control placed in other update panel will not affect this updatepanel.|
|Questions : 11||Tell name of all the control of Ajax?|
|Answer : 11||There are 5 controls. 1. ScriptManager 2. UpdatePanel 3. UpdateProgress 4. Timer 5. ScriptManageProxy|
|Questions : 12||What will happen with click of browser "back" button among asynchronous requests?|
|Answer : 12||By default, browser will unload the web page and and will return to previous Web page, independent of any asynchronous requests.|
|Questions : 13||This attribute of scriptmanager is useful to implement browser history management,|
|Answer : 13||EnableHistory|
|Questions : 14||To create browser history point using client script, we make call method…?|
|Answer : 14||Sys.Application.addHistoryPoint|
|Questions : 15||What is AjaxControl ToolKit?|
|Answer : 15||AjaxControl Toolkit is an open source project built on top of ajax framework. It has more than 30 controls which are really cool and useful. Visit this site to find out more about AjaxControlToolKit. http://www.asp.net/(S(fu2l2uzphr2u3u45q2dnez55))/ajax/AjaxControlToolkit/Samples/|
|Questions : 16||Is there any property names “IsNavigating”?|
|Answer : 16||Yes, it is available when you are managing browser history. With this property of IsNavigating, you can determine if postback is occurred for navigation purpose or for some other. Its set to true if its navigation call.|
|Questions : 17||What role "#&&" plays in a querysting?|
|Answer : 17||# works as a fragment delimeter in a querysting. With which you can delimit history state. While && preceeds, state information in query string.|
|Questions : 18||What is the name of the dll that contains the Ajax Control Toolkit?|
|Answer : 18||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.|
|Questions : 19||How to control the duration of an AJAX request?|
|Answer : 19||It is controlled using the AsyncPostBackTimeout property of the ScriptManager control. eg: < 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.|
|Questions : 20||how can we detect asynchronous partial page postbacks?|
|Answer : 20||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.|
|Questions : 21||Which two methods are used for handling Cross-Domain Ajax Calls ?|
|Answer : 21||
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.
|Questions : 22||What are the disadvantages of AJAX?|
|Answer : 22||
These are the disadvantages: |
3) source code written for AJAX is easily human readable.
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.