ASP .Net AJAX « Datadial Blog
0208 6000 500
Tyrone

Tyrone

July 14th, 2008.


Filed under Development

ASP .Net AJAX

Ajax stands for Asynchronous JavaScript and XML and has become hugely popular due to concepts such as Web 2.0 that has been made fashionable by companies like Amazon and Google. The key word in the definition of AJAX is Asynchronous! Despite all the wonderful web technologies available today the method in which users access web content is still synchronous (i.e. request / response model). This means that when a user navigates to a web page, their browser makes a request to the web server and then waits for a response. This means that replicating the quick seamless response of a desktop application is almost impossible due to the distance the data has to travel. This request for a web page (known as a postback) requires the server to render / re- render a page’s content to the users browser window (i.e. the server returns a complete page of HTML).

Synchronous postbacks are one the major disadvantages of many of today’s websites as the round trip from the client to the server can be slow; especially when accessing web pages that require intensive updates (i.e. pages that contain large images or other rich media content). This is perfectly illustrated by comparing the Synchronous model of http://www.streetmap.co.uk/ to the Asynchronous model of http://maps.google.co.uk/. Google Maps seamlessly delivers it content while the user browses and Street Map performs postbacks every time the user requests a different section of the map.

Introducing ASP .Net AJAX (Synchronous Vs. Asynchronous)
Consider the case whereby a web site has to regularly update its content with ever-changing information, e.g. stock prices. This stock price information may only take up a small portion of the page but in-order for this small update to occur a full page postback is required. Even on a good day when the round trip to the web server is fast this will still case the browser to blink / flash and on a bad day users will be left staring at a blank white page while the server build the new page and posts back the results.

When using AJAX enabled web pages it is possible to implement partial page updates whereby the only part of the page is updated allowing the users to continue browsing other content while a specific region of the page is updated. The addition of visual loading indicators are also possible as a welcome change from a blank screen and give user a clear indication of what is going on.

ASP .Net AJAX Architecture


Using conventional ASP .Net controls the server is responsible for dynamically creating HTML mark-up which isn’t ideal as it doesn’t provide a clean separation of presentation and business logic. ASP .Net AJAX follows a different model whereby data is still managed on the server but presentation is handled by the client side components that run in the browser.

The AJAX library has been developed to make client-side functionality easier as it provides core classes that extend JavaScript to support object orientated scripting. It contains a base class library that also offers error handling, debugging and tracing; a network layer that provides asynchronous communication and an application services layer, UI layer and Browser layer.

From a programming point of view the AJAX library provides a more powerful JavaScript programming model that offers many of the constructs that are needed for object orientated programming like, namespaces, interfaces and inheritance.

Summary
ASP .Net AJAX can be easily incorporated into excising ASP .Net applications and makes it possible to develop a richer client-side experience.

Combining the client-side Microsoft AJAX library and ASP .Net AJAX 2.0 Extensions .Net developers can add an extensive array of new functionality using a familiar object orientated programming environment (Visual Studio .Net, Dreamweaver etc), Web Services and new sever controls, all in a unified design and coding framework. With the new possibilities that ASP .Net AJAX provides the key decision for developer is how much of the application logic to place on the client (JavaScript) and how much to place on the server (VB. Net, C#)?

Leave a comment

Recent Posts »

Our work »

What we do »

Who we work with »

Got Questions? Lets Talk »