..


Sponsored Links

Introduction to AJAX

AJAX (which stands for Asynchronous JavaScript and XML) is a technology introduced by ASP.NET platform with the aim of improving the appearance of web applications and the interaction between them and users. As part of the software when technology seems to be pretty stable usually becomes the priority to improve the interaction of the same with the user (referred to as user's experience).

These applications that enhance the user interaction in computer jargon is called RIA (Rich Internet Application). AJAX is a tool through which to design their own RIAs.

The first reason that led to the emergence of AJAX has been to improve the phases HTTP GET / POST web pages. In fact, although the standard HTTP is now functional and well known by developers, it has limitations, the first of which is that you have to wait for a certain period of time while pages are updated. AJAX introduces mechanisms that prevent (or reduce) this expectation.

Think of how the HTTP protocol when making a request, the browser sends the server the same and you can not do anything else until this process comes to an end. In practice, therefore, it sends the request and expects, while the indicator at the bottom of the browser shows the level of completion of the transaction and only when the control is returned to the browser you can start using the application.

The application is therefore useless as long as the request does not return, and in many cases the browser window turns completely white. The solution proposed by AJAX is to introduce something that can handle the request asynchronously so that the browser is more responsive interaction with the user is not blocking the entire page but only the necessary portion.

One innovation which has contributed to the AJAX web programming is the introduction of new libraries to facilitate client-side asynchronous calls to the server. Another novelty is the introduction of new server-side components to support these new asynchronous calls from clients.

The following image, taken from the Microsoft site, summarizes the conceptual universe AJAX

At first glance, AJAX seems to introduce more complexity in how to develop web applications but in reality this technology brings some key advantages:

  • Elimination of dead time waiting for a reply sent to the server via the HTTP protocol
  • Introduction of graphics typically found in desktop applications and windows as pop-ups very useful for interacting with users
  • Introduction Partial updating of pages, only the relevant sections
  • Extended support to all popular browsers, not just Internet Explorer
  • Introduction of the extender control, a new type of controls that add a new look and new features to the usual controls on the client side
  • Improved authentication services, profiles and personalization

Most of the support provided by ASP.NET AJAX is a set of server side controls responsible for rendering web pages in the new style introduced by this new technology. In general the work of a server-side control is to produce an output that places the HTML elements so that they appear correctly in browsers and AJAX-style controls behave the same way.

AJAX-style controls are used most frequently:

  • ScriptManager
    Manages scripts on the page. His first action is to register the AJAX Library with the page so that scripts can use its client-side extensions. This control also allows partial rendering of pages.
  • ScriptManagerProxy
    The scripts on a web page often require special handling on the way in which the server should run them. Typically a ScriptManager control is used to organize scripts and other page-level nested components (such as user controls) require the ScriptManagerProxy control to manage pages and services that have already have a ScriptManager control. An example of this situation are the master page that typically contains a ScriptManager control. ASP.NET throws an exception if if a second instance of that control is located on a given page and therefore the content pages that use those master pages are required to use certain control ScriptManagerProxy.
  • UpdatePanel
    This control enables partial-page updates.
  • UpdateProgress
    Show status information about partial-page updates that occur via the UpdatePanel control.
  • Timer
    This control generates postback at predefined intervals. It is used especially in close relationship with the UpdatePanel control to perform partial updates of certain sections of the regular pages.

Support client-side AJAX instead focuses on a set of JavaScript libraries that include the following levels:

  • Level of browser compatibility that ensures the compatibility of the AJAX features on popular browsers;
  • Core services that extend the traditional JavaScript environment by introducing classes, namespaces, event handlers, data types and serialization of objects;
  • Library based on client-side class that includes several components, such as those for handling strings and one for the extension of error handling;
  • Network layer that handles communication between web services and e applications. This level is responsible for managing the asynchronous calls as well;

Very useful is the ASP. NET Control Toolkit, which consists of a collection of components (and examples that show how to use them) that allow the use of AJAX features. This toolkit also provides a software development kit to create custom controls and can be downloaded from the official website of ASP.NET AJAX. It is not included in Visual Studio 2010 and must be downloaded separately. For full details please refer to this page .

It 'can download binaries or source code. If you do not care to use the source code for this component simply add a reference to AjaxControlToolkit.dll to your projects.

In addition to AJAX in recent years have introduced many other useful technologies such as Silverlight, WPF, WCF, which will not be covered in this guide as have already been presented with some specific items that you can find in the articles section of our ASP.NET site.

Help with Visual Studio ASP.Net
E-Learning
ASP (Advanced) ASP (Advanced)
Full course for creating dynamic Web sites. From 39 €.
ASP.NET (Course) ASP.NET (Course)
Full course for building Web applications from 49 €.
SQL and Database (Course) SQL and Database (Course)
Create and manage relational databases. From 39 €.
Sponsored Links