Chapter 3. Snappier Web Sites with AJAX

AJAX has revolutionized ASP.NET, and from this moment forward most ASP.NET applications will routinely integrate AJAX controls. AJAX moves ASP.NET applications from being 99% server-side code, to offering the option for a great deal of the processing to happen on the user’s browser. The net effect is a tremendous increase in both real and perceived performance of ASP.NET applications.

To demonstrate how much more dynamic and responsive AJAX is, you’ll rewrite the order form from Chapter 2, applying Ajax techniques. You’ll enhance the site by adding a watermark to user entry fields. A watermark is a bit of text that appears in the text field itself, but disappears as soon as the user starts typing. It serves as an elegant prompt to the user. You will also create a pop-up panel to hide controls until the user needs them, and you’ll add a collapsible text field to display product information in a very space-efficient manner.

Take a Walk on the Client Side

While server-based web applications have wonderful advantages, they have the obvious disadvantage that any time you want to run any code (or retrieve any data) you must endure the cost of a “round trip” from the browser to the server and back, and the page must be redrawn from scratch. Round trips can be slow (though the Internet is getting faster all the time) and redrawing the page causes a noticeable flicker.

AJAX (which more accurately should be spelled AJX, but that’s harder to pronounce) is ...

Get Learning ASP.NET 2.0 with AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.