2.1. ASP.NET 3.5 Brings a Lot to the Table

Prior to Visual Studio 2008, the ASP.NET AJAX product was a separate installation that you were required to install on your machine and the Web server that you were working with. This release gained in popularity quite rapidly and is now a part of the Visual Studio 2008 offering. Not only is it a part of the Visual Studio 2008 IDE but the ASP.NET AJAX product is also baked into the .NET Framework 3.5. This means that to use ASP.NET AJAX, you don't need to install anything if you are working with ASP.NET 3.5.

If you are using an ASP.NET version that is prior to the ASP.NET 3.5 release, then you need to visit www.asp.net/AJAX to get the components required to work with AJAX.

ASP.NET AJAX is now just part of the ASP.NET Framework. When you create a new Web application, you do not have to create a separate type of ASP.NET application. Instead, all ASP.NET applications that you create are now AJAX-enabled.

If you have already worked with ASP.NET AJAX prior to this 3.5 release, you will find that there is really nothing new to learn. The entire technology is seamlessly integrated into the overall development experience.

To sum up what AJAX is all about in relation to ASP.NET in a simple phrase, it would be "an improved experience for the end user through partial page updates and a better user interface." At the core of the ASP.NET AJAX offering is the UpdatePanel control (introduced in this chapter), which provides the capability to have portions of a page update asynchronously. The other half of the equation is richer user interface (UI) elements: controls that leverage the browser features better or extenders that enhance the functionality of other controls.

Overall, Microsoft has fully integrated the entire ASP.NET AJAX experience so you can easily use Visual Studio 2008 and its visual designers to work with your AJAX-enabled pages and even have the full debugging story that you would want to have with your applications. Using Visual Studio 2008, you are now able to debug the JavaScript that you are using in the pages.

In addition, it is important to note that Microsoft focused a lot of attention on cross-platform compatibility with ASP.NET AJAX. You will find that the AJAX-enabled applications that you build upon the .NET Framework 3.5 can work within all the major up-level browsers out there (e.g., Firefox and Opera).

2.1.1. Client-Side Technologies

There really are two parts of the ASP.NET AJAX story. The first is a client-side framework and a set of services that are completely on the client-side. The other part of the story is a server-side framework. Remember that the client-side of ASP.NET AJAX is all about the client communicating asynchronous requests to the server side of the offering.

For this reason, Microsoft offers a Client Script Library, which is a JavaScript library that takes care of the required communications. The Client Script Library is presented in Figure 2-1.

The Client Script Library provides a JavaScript, object-oriented interface that is reasonably consistent with aspects of the .NET Framework. Because browser compatibility components are built in, any work that you build in this layer or (in most cases) work that you let ASP.NET AJAX perform for you here will function with a multitude of different browsers. Also, several components support a rich UI infrastructure that produces many things that would take some serious time to build yourself.

The interesting thing about the client-side technologies that are provided by ASP.NET AJAX is that they are completely independent of ASP.NET. In fact, any developer can freely download the Microsoft AJAX Library (again from www.asp.net/AJAX) and use it with other Web technologies such as PHP (found at www.php.net) and Java Server Pages (also known as JSP). With that said, really the entire Web story is a lot more complete with the server-side technologies that are provided with ASP.NET AJAX.

2.1.2. Server-Side Technologies

As an ASP.NET developer, you will most likely be spending most of your time on the server-side aspect of ASP.NET AJAX. Remember that ASP.NET AJAX is all about the client-side technologies talking back to the server-side technologies. You can actually perform quite a bit on the server-side of ASP.NET AJAX.

Figure 2-1. Figure 2-1

The server-side framework knows how to deal with client requests (e.g., putting responses in the correct format). The server-side framework also takes care of the marshaling of objects back and forth between JavaScript objects and the .NET objects that you are using in your server-side code. Figure 2-2 illustrates the server-side framework provided by ASP.NET AJAX.

When you have the .NET Framework 3.5, you have the ASP.NET AJAX Server Extensions on top of the core ASP.NET 2.0 Framework, the Windows Communication Foundation, as well as ASP.NET-based Web services (.asmx).

2.1.3. Developing with ASP.NET AJAX

There are a couple of types of Web developers out there. There are the Web developers who are used to working with ASP.NET and who have experience working with server-side controls and manipulating these controls on the server side. Then there are developers who concentrate on the client side and work with DHTML and JavaScript to manipulate and control the page and its behaviors.

With that said, it is important to realize that ASP.NET AJAX was designed for both types of developers. If you want to work more on the server side of ASP.NET AJAX, you can use the new ScriptManager control and the new UpdatePanel control to AJAX-enable your current ASP.NET applications with little work on your part. All this work can be done using the same programming models that you are quite familiar with in ASP.NET.

Both the ScriptManager and the UpdatePanel controls are discussed later in this chapter.

Figure 2-2. Figure 2-2

You can also use the Client Script Library directly and gain greater control over what is happening on the client's machine. This book will make use of both throughout. Next, this chapter looks at building a simple Web application that makes use of AJAX.

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

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