Professional ASP.NET 3.5 AJAX

Book description

ASP.NET revolutionized Web application development. The platform handles many of the complexities of creating Web applications. Now ASP.NET AJAX takes the development platform even further. The lines between rich client applications and traditionally less interactive browser-based applications are being further blurred with the use of this technology.

The ASP.NET AJAX Library brings object-oriented programming to JavaScript development for modern browsers, and the ASP.NET AJAX Extensions makes it easy to write rich Web applications that communicate with the Web server asynchronously. Again, the complexities are made easy by using ASP.NET.

The new server controls that are part of ASP.NET AJAX make it simple to designate parts of the page to be updated automatically without making the user pause and wait while the data is refreshed. You can have partial page updates without writing a single line of code. Other new controls let you alert the user that background work is happening and designate regular intervals at which updates occur. In addition, the ASP.NET AJAX Control Toolkit makes it easy to make your user interface really come to life with animations, modal dialogs, transition effects, and more.

Ajax is definitely the hot buzzword in the Web application world at the moment. Ajax is an acronym for Asynchronous JavaScript and XML and, in Web application development, it signifies the capability to build applications that make use of the XMLHttpRequest object.

The creation and the inclusion of the XMLHttpRequest object in JavaScript and the fact that most upper-level browsers support the use of this object led to creation of the Ajax model. Ajax applications, although they have been around for a few years, gained greater popularity after Google released a number of notable, Ajax-enabled applications such as Google Maps and Google Suggest. These applications demonstrated the value of Ajax.

Shortly thereafter, Microsoft released a beta for a new toolkit that enabled developers to incorporate Ajax features in their Web applications. This toolkit, code-named Atlas and later renamed ASP.NET AJAX, makes it extremely simple to start using Ajax features in applications today.

Prior to Visual Studio 2008, the ASP.NET AJAX product used to be a separate application that developers were required to install on their machine and the Web server that they were working with. This release gained in popularity quite rapidly and has now been made a part of the Visual Studio 2008 offering. Not only is it a part of the Visual Studio 2008 IDE, the ASP.NET AJAX product is also baked into the .NET Framework 3.5. This means that in order to use ASP.NET AJAX, developers are not going to need to install anything if they are working with ASP.NET 3.5.

Overall, Microsoft has fully integrated the entire ASP.NET AJAX experience in that developers can easily use Visual Studio and its visual designers to work with your Ajax-enabled pages and even have the full debugging story that they would want to have with their applications. Using Visual Studio 2008, developers are now able to debug straight into the JavaScript that they 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. Developers will find that the Ajax-enabled applications that they build upon the .NET Framework 3.5 are able to work within all the major up-level browsers out there (e.g., FireFox and Opera).

This book is aimed at experienced ASP.NET developers looking to add AJAX to their applications, and experienced Web developers who want to move to using ASP.NET and AJAX together.

In this book, I assume that you already have an understanding of how ASP.NET works. For an in-depth discussion of ASP.NET, I recommend Professional ASP.NET 3.5 by Bill Evjen, et al. (Wrox, 2008). The focus here is on how you can extend ASP.NET applications to update portions of the page asynchronously and to add richer UI elements to a page. ASP.NET AJAX makes it easy to enrich your existing application or to design a new application to provide a better experience for users. The differences among modern browsers have been abstracted, allowing you to write to a common set of APIs and trust that the user will get the correct behavior whether they are using Internet Explorer, Firefox, or Safari.

If you know how to author ASP.NET pages, you can easily start using the Microsoft AJAX library to manipulate the browser's Document Object Model and communicate with the server to update the user's view of data without forcing them to wait for the entire page to be refreshed.

This book covers ASP.NET 3.5 AJAX. It does not cover ASP.NET 3.5, on which ASP.NET AJAX is built. The examples lead you from the core of what is included in the ASP.NET AJAX Library through the core controls you would first start using. You build on that using the core JavaScript library and the ASP.NET AJAX Toolkit before covering debugging, deployment, and custom control development.

The ASP.NET 3.5 release includes the Microsoft AJAX Library as well as the server controls that can be used in ASP.NET pages to extend applications, making them more rich and interactive. It does so by leveraging the ASP.NET AJAX Library, which is JavaScript that runs in the browser. The server controls and JavaScript Library work together to let you update HTML with data obtained asynchronously from the server. The ASP.NET application services are exposed to JavaScript classes in the ASP.NET AJAX Library, making authentication and personalization accessible from the browser.

Chapter 1 introduces you to ASP.NET AJAX. This book discusses the need for AJAX Libraries and explain how ASP.NET AJAX compares to other AJAX Libraries. You will see how ASP.NET AJAX is composed of client and server pieces and that you can use the client library with any server platform you choose. In Chapter 2, the focus is on the most popular and easily applied feature of ASP.NET, the UpdatePanel control. This control allows you to automatically update portions of a page asynchronously, without subjecting the user to a visible pause while the page refreshes. Chapters 3 and 4 give you some key information about working with JavaScript and how the ASP.NET AJAX Library makes development with JavaScript easier. The book then works through several key features, including control of script resources and working with the ScriptManager control in Chapter 5, the new ASP.NET 3.5 ability to work with the back button in Chapter 6, and the ASP.NET AJAX Toolkit in Chapter 7 and all it has to offer for creating rich user interfaces. The next chapter, Chapter 8, looks at how to use ASP.NET's application services (such as the Membership and Role management systems) with ASP.NET AJAX. Chapter 9 looks at networking objects. Chapter 10 looks at working with animations in ASP.NET AJAX. Chapter 11 shows you how to develop custom AJAX controls. Chapters 12, 13, and 14 shows the reader how to incorporate Ajax in some other ASP.NET core features such as Web Parts, localization, and state management. Chapter 15 looks at what is required to test and debug Ajax applications, and finally, Chapter 16 explores how to deploy ASP.NET AJAX applications.

Table of contents

  1. Copyright
  2. Dedication
  3. About the Authors
  4. About the Technical Editor
  5. Credits
  6. Acknowledgments
  7. Introduction
  8. Overview of AJAX
    1. Why AJAX Applications Are Needed
    2. Bringing Richness to Web Applications
    3. Who Benefits from AJAX?
    4. Technologies of AJAX
    5. AJAX Libraries
    6. Creating a Simple Web Page with AJAX
    7. The Power of AJAX
    8. Summary
  9. ASP.NET 3.5 and AJAX
    1. ASP.NET 3.5 Brings a Lot to the Table
    2. ASP.NET AJAX Applications
    3. ASP.NET AJAX's Server-Side Controls
    4. Using Multiple UpdatePanel Controls
    5. The Client-Side Page Request Lifecycle
    6. Canceling a Request
    7. Detecting Errors
    8. Working with Updates
    9. Summary
  10. JavaScript for the ASP.NET Developer
    1. Using JavaScript on the Client
    2. Variable Types in JavaScript
    3. Language Anomalies
    4. Scoping Variables
    5. Using Prototypes
    6. Close on Closures
    7. Evaluating eval()
    8. Handling Exceptions
    9. Getting Parts of a String
    10. Better JavaScript
    11. Summary
  11. Understanding the ASP.NET AJAX Client Library
    1. The Browser Page Lifecycle
    2. Using the Type System
    3. Base Class Library
    4. Supporting IntelliSense
    5. Errors and Debugging
    6. The Browser Object
    7. The Sys Namespace
    8. Summary
  12. Using the ScriptManager
    1. The Ubiquitous ScriptManager
    2. ASP.NET Application Services
    3. Error Handling
    4. Customizing the Location of Scripts
    5. Script Combining
    6. Summary
  13. Controlling the Back Button
    1. The Document Fragment Indicator
    2. Sample Application
    3. Enabling Partial Updates
    4. Adding History Support
    5. State Encoding
    6. Managing History Client-Side
    7. Client-Side Updates
    8. Adding History Support
    9. Deep Linking
    10. Summary
  14. The ASP.NET AJAX Toolkit
    1. Downloading and Installing
    2. The ASP.NET AJAX Controls
    3. ASP.NET AJAX Control Toolkit Server Controls
    4. Summary
  15. ASP.NET AJAX Application Services
    1. Authenticating Users
    2. Managing User Roles
    3. Summary
  16. ASP.NET AJAX Networking
    1. The XMLHttpRequest Object
    2. Making WebRequest Calls
    3. Managing Web Requests
    4. Passing Data
    5. Summary
  17. Working with Animations
    1. Working with the Animation Control
    2. Examples of Animation Actions
    3. Summary
  18. Building Custom Controls
    1. Building Client-Side ASP.NET AJAX Controls
    2. Building a Server-Side ASP.NET AJAX Control
    3. Summary
  19. Web Parts
    1. Introducing Web Parts
    2. Building a Web Parts Page without AJAX
    3. Understanding Postbacks with Web Parts
    4. Adding AJAX to the Web Parts Page
    5. Building a Custom Web Part with AJAX
    6. Summary
  20. Localization
    1. What Is Localization?
    2. Cultures and Regions
    3. Server-Side versus Client-Side Localization
    4. Client-Side Culture Details
    5. ASP.NET 3.5 Resource Files
    6. Looking at the Resource Editor
    7. Script Localization with Static Files
    8. Embedding JavaScript Files
    9. Summary
  21. State Management
    1. Understanding State in .NET
    2. Understanding Sessions
    3. Using the Application Object
    4. Using Cookies
    5. Using ViewState
    6. State Management and ASP.NET AJAX
    7. Summary
  22. Testing and Debugging ASP.NET AJAX Applications
    1. Debug and Release Scripts
    2. Using the Error Class
    3. Using the Sys.Debug Class
    4. Enabling Internet Explorer for Debugging
    5. Debugging with Firefox and Firebug
    6. Viewing ASP.NET AJAX Request and Response Messages
    7. Summary
  23. Deploying ASP.NET AJAX Applications
    1. Installing the Bits
    2. Preparing for Web Farm Deployment
    3. Using a Different Platform
    4. Avoiding Common Configuration Problems
    5. Creating Web Deployment Projects
    6. After Deployment
    7. Using Compression for Scripts
    8. Summary
  24. ASP.NET AJAX Resources
  25. Index

Product information

  • Title: Professional ASP.NET 3.5 AJAX
  • Author(s): Dave Reed, Bill Evjen, Dan Wahlin, Matt Gibbs
  • Release date: February 2009
  • Publisher(s): Wrox
  • ISBN: 9780470392171