Chapter 5. The Microsoft AJAX Library

After completing this chapter, you will

  • Understand and utilize the Microsoft AJAX Library.

  • Understand the Sys.Net Network Library.

  • Understand the document object model and the Microsoft AJAX extensions to programming the DOM through the Microsoft AJAX Library.

In Chapter 4, we looked at the basic AJAX runtime and how it utilizes the Script Manager and the ASP.NET AJAX programming model. We also looked at object-oriented JavaScript and at Microsoft’s type extensions to the JavaScript language. Building on the core type system, the Microsoft AJAX Library is implemented in logical namespaces that provide functionality for the client-side AJAX application. In this chapter I’ll explain the main namespaces and types, including the network library and the Document Object Model (DOM) programming model.

The Microsoft AJAX Library Client Framework

The Microsoft AJAX Library consists of a central framework of components, controls, and utilities, as well as a network stack and Web service proxies, all implemented in JavaScript. While the AJAX library is targeted toward AJAX applications, most of the library supports approaches to dynamically programming client browsers and can be used in any type of browser-based application, whether the application uses an AJAX programming model or a Web Forms programming model. Because an AJAX application often includes more code for manipulating the browser’s user interface than a traditional Web application, where the rendering is done on the server, a robust framework of controls, utilities, and debugging support is needed for an AJAX application. Table 5-1 lists the key JavaScript namespaces in the Microsoft AJAX Library, which are all defined under the root namespace Sys.

Table 5-1. JavaScript Namespaces in the AJAX Library

Namespace

Description

Sys

The root namespace for the Microsoft AJAX Library. Contains all fundamental classes and base classes, including the Component base class and the client runtime Sys.Application object.

Sys.Net

Contains the core network stack for Web service calls, wrapping the native XMLHttpRequest object in a browser-safe abstraction.

Sys.Serialization

Contains the JavaScriptSerializer class, which is used for data serialization for Microsoft ASP.NET AJAX client applications and has enhanced JSON-parsing capabilities.

Sys.Services

Contains types that provide script access in ASP.NET AJAX client applications to the ASP.NET authentication service, profile service, and role service. Use this namespace with Web services defined in System.Web.ApplicationServices.

Sys.UI

Contains types related to the user interface (UI), such as controls, events, and UI properties in the Microsoft AJAX Library. Use base classes in this namespace to implement custom client-side controls. Use the static DOM-related classes in this namespace to manipulate the client interface.

Tip

Tip

Although the Microsoft AJAX Library does not parallel the Microsoft .NET Framework, it is conceptually similar in design and structure.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset