Conclusion
Most attentive developers have been developing around interactive Web technologies since the late 1990s. Various technologies (for example, Microsoft Remote Scripting and opensource and commercial variations) have been developed without forming a critical mass of acceptance and use. Or perhaps the mass was big enough, but everyone was waiting for the spark of a killer application. Another factor that slowed down the adoption of more advanced client techniques was the lack of cross-browser support for them.
Today, the situation is
radically
different from what it was only three or four
years
ago. Now about 90 percent of the available browsers support all the minimal requirements for implementing interactive Web applications, known as AJAX applications. In addition, the W3C is standardizing the
XMLHttpRequest
object, which is the necessary communication workhorse behind all existing platforms for AJAX. The
next
generation of Web applications will be based on a different mechanism: it is no longer, or not just, forms posted in a change of pages, but individual
requests
for data and dynamic updates to displayed pages.
As a server technology aimed at the creation of Web pages, ASP.NET takes advantage of the opportunity for providing this much desired functionality. Script callbacks were the first Microsoft attempt to offer an API for building AJAX-style pages. Modeled after the classic postback event, callbacks are sometimes unnecessarily heavy and
inflexible
.
An add-on to ASP.NET 2.0, Microsoft ASP.NET AJAX Extensions, shows the way ahead for AJAX applications as far as the ASP.NET platform is
concerned
. It integrates the AJAX lifestyle into the existing application model of ASP.NET, resulting in a familiar programming model with greatly improved and richer functionality.
Chapter 2:
The Microsoft Client Library for AJAX
Overview
Most of the power of AJAX resides on the client and is
strictly
related
to the browser’s and platform’s client-side functionality. Even though a large share of AJAX pages are built using a slightly different set of server controls, they couldn’t work without a powerful environment available on the client and written in JavaScript. Such a script code governs the execution of out-of-
band
calls and often kicks in and
replaces
regular postbacks with AJAX postbacks. No AJAX functionality would ever be possible without JavaScript and a standard (and rich) Document Object Model (DOM). The DOM, though, is not enough.
The DOM represents the programming gateway to the page
constituent
elements, but it is not designed to provide programming facilities such as those you can find in a general-purpose library. Normally, the script tools you can leverage to
consume
objects and contents from the DOM are those provided by the JavaScript language. Not exactly a powerful toolkit. Enter the Microsoft AJAX Library.
The Microsoft AJAX library is written in JavaScript, although with a strong sense of objectorientation. The JavaScript language does support objects and allow the creation of custom objects. It does not, however, support full object-orientedness since it has no native concept of true object inheritance. Nonetheless, even excluding true object-orientation, JavaScript is still a modern and suitable language that can be used to build a class framework a la the .NET Framework. ASP.NET AJAX takes the JavaScript language to the
next
level by adding some type-system extensions and the notions of namespace and inheritance. In addition, the ASP.NET AJAX JavaScript supports interfaces and enumerations, and has a number of helper functions to manipulate strings and arrays.
These extensions are coded using the base set of instructions that characterize the
core
JavaScript language, and they’re
persisted
to the
.js
files that form the Microsoft AJAX client runtime environment.
In this chapter, you’ll first learn how to use extensions to JavaScript-such as namespaces, interfaces, and inheritance-and then take the plunge into the namespaces and classes that form the client-side AJAX framework.