O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing Microsoft® ASP.NET AJAX

Book Description

Get an expert introduction to the new JavaScript enhancements (code-named â??Atlasâ?) for Microsoft ASP.NET 2.0. More than a basic AJAX (Asynchronous JavaScript And XML) script library, the Microsoft implementation brings object orientation to JavaScript, together with enhanced client-side and server-side controls that greatly simplify coding while delivering enhanced Web experiences with any browser. Scheduled for release with the next version of Microsoft Visual Studio®, code named â??Orcas,â? AJAX extensions and tools can be used by developers today. This book offers expert insights direct from the Microsoft product team and noted ASP authority Dino Esposito, as well as hands-on instruction and examples of Web development with AJAX. This ideal reference will be updated online until the final release, keeping readers up to date with the evolving tool. The book includes code samples in ASP.NET 2.0 created using C#and JavaScript.

Visit the catalog page for Introducing Microsoft® ASP.NET AJAXVisit the errata page for Introducing Microsoft® ASP.NET AJAXVisit the supplemental content page for Introducing Microsoft® ASP.NET AJAX

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. Introduction
    1. Who This Book Is For
    2. How This Book Is Organized
    3. System Requirements
    4. Configuring SQL Server 2005 Express Edition
    5. Code Samples
    6. Support for This Book
      1. Questions and Comments
  4. I. ASP.NET AJAX Building Blocks
    1. 1. The AJAX Revolution
      1. The Paradigm Shift
        1. Classic Web Applications
          1. Send Input via Forms
          2. Get Output through Pages
          3. Capabilities and Drawbacks
        2. AJAX-Based Web Applications
          1. What Is AJAX, Anyway?
          2. Update Pages via Script
          3. The Document Object Model
        3. The Role of Rich Browsers
          1. Rich vs. Reach
          2. Required Capabilities
      2. The AJAX Core Engine
        1. The XMLHttpRequest Object
          1. The Internet Explorer Object
          2. The Mozilla Counterpart
          3. XMLHttpRequest in Internet Explorer 7
        2. An HTTP Object Model
          1. Behavior and Capabilities
          2. Sending a Request
          3. Receiving a Response
        3. Roll Your Own (Little) AJAX Framework
          1. Executing an Out-of-Band Call from an ASP.NET Page
          2. Displaying Results
        4. The Switch to the Document Object Model
          1. Representation of a Document
          2. DOM Implementation
          3. Be Pragmatic: DHTML vs. DOM
          4. Be Pragmatic: Use Events
        5. Existing AJAX Frameworks for ASP.NET
          1. ASP.NET Script Callbacks
          2. The AJAX.NET Professional Library
          3. The Anthem.NET Framework
          4. The ComfortASP.NET Framework
          5. The Telerik r.a.d.controls for ASP.NET Framework
          6. The ComponentArt Web.UI Framework
          7. Infragistics’s NetAdvantage for ASP.NET AJAX
          8. Categorizing AJAX Frameworks
      3. ASP.NET AJAX in Person
        1. Setting Up ASP.NET AJAX Extensions
          1. Installing ASP.NET AJAX Extensions
          2. Deploying ASP.NET AJAX Applications
        2. Core Components
          1. The Microsoft Client Library for AJAX
          2. Server-Based Components
          3. The JSON Infrastructure
      4. Conclusion
    2. 2. The Microsoft Client Library for AJAX
      1. JavaScript Language Extensions
        1. Infrastructure for Extensions
          1. The Microsoft AJAX Library Engine
          2. The Root Object of the Microsoft AJAX Library
          3. Other Top-Level Types
          4. Discovering Type Information
          5. Reflection Capabilities
          6. The $get Alias
          7. Closures vs. Prototypes
        2. Object-Oriented Extensions
          1. Adding Namespace Support
          2. Adding Inheritance Support
          3. Adding Interface Support
      2. Core Components
        1. The Sys.Application Object
          1. Generalities of the Sys._Application Class
          2. Looking Up Components
          3. Events in the Page Lifetime
        2. The Sys.Component Object
          1. The Sys.Component Class
          2. Detecting Property Changes
          3. Batched Updates
          4. The $create Alias
          5. Component Disposing
        3. The Network Stack
          1. The Sys.Net.WebRequest Class
          2. The XML HTTP Executor
          3. The Sys.WebForms.PageRequestManager Class
        4. User-Interface Components
          1. The Sys.UI.Behavior Class
          2. The Sys.UI.Control Class
          3. The Sys.UI.DomElement Class
          4. Handling DOM Events
          5. A Cross-Browser Model for Events
        5. Other Components and Functionalities
          1. String Manipulation
          2. Debugging Facilities
      3. Conclusion
  5. II. Adding AJAX Capabilities to a Site
    1. 3. The Pulsing Heart of ASP.NET AJAX
      1. Configuration of ASP.NET AJAX
        1. The web.config File
          1. New Configuration Sections
          2. The <scripting> Section
          3. The <webServices> Section
        2. The Runtime Engine
          1. The ScriptResource HTTP Handler
          2. The ScriptModule HTTP Module
      2. The Script Manager Component
        1. The ASP.NET ScriptManager Control
          1. Properties of the ScriptManager Control
          2. Methods of the ScriptManager Control
          3. Events of the ScriptManager Control
          4. The ScriptManagerProxy Control
        2. Script Loading
          1. Adding Script Resources
          2. Mapping Script Paths
          3. Resolving and Overriding Script Files
          4. Script Globalization
          5. Script Localization
          6. The Script Registration Model
        3. Script Error Handling
          1. Handling Debug and Release Scripts
          2. Custom Error Handling and Redirection
      3. Conclusion
    2. 4. Partial Page Rendering
      1. Defining Updatable Regions
        1. Generalities of the UpdatePanel Control
          1. The UpdatePanel Control at a Glance
          2. The Programming Interface of the Control
          3. Programmatic Updates
          4. The Eventing Model of the Control
        2. Enabling Partial Rendering
          1. Defining the Updatable Contents
          2. Defining Regions Programmatically
          3. Rendering Modes
          4. Detecting Ongoing Updates
        3. Testing the UpdatePanel Control
          1. A First Sample Page
          2. Using AJAX for Multistep Operations
          3. Using AJAX for Quicker Data Validation
          4. Master Pages and Partial Updates
          5. Partial Updates from User Controls
        4. The Mechanics of Updatable Panels
          1. Client Script Injection
          2. Format of the AJAX Request
          3. Detecting AJAX Requests at Runtime
          4. Format of the AJAX Response
          5. One Partial Update at a Time
          6. Error Handling in Partial Updates
      2. Taking Control of Updatable Regions
        1. Triggering the Panel Update
          1. Updating Modes
          2. Conditional Refresh of an UpdatePanel Control
          3. Programmatic Updates of Panels
          4. Triggers of an UpdatePanel Control
          5. Full Postbacks from Inside Updatable Panels
        2. Triggering Periodic Partial Updates
          1. Generalities of the Timer Control
          2. Using the Timer
        3. Providing User Feedback During Partial Updates
          1. Generalities of the UpdateProgress Control
          2. Composing the Progress Screen
          3. Aborting a Pending Update
          4. Associating Progress Screens with Panels
        4. Client-Side Events for a Partial Update
          1. Events of the Client PageRequestManager Object
          2. Kick In before the Request Starts
          3. Disabling Visual Elements during Updates
          4. Managing Progress Screens
          5. Page Loading Events
        5. Passing Data Items during Partial Updates
          1. Motivation for Using Data Items
          2. Preparing Data Items
          3. Data Items as JSON Strings
          4. Retrieving Data Items on the Client
        6. Animating Panels during Partial Updates
          1. Visual Feedback during the Partial Update
          2. Visual Feedback after the Page Refresh
      3. Conclusion
    3. 5. The AJAX Control Toolkit
      1. Extender Controls
        1. What Is an Extender, Anyway?
          1. Formalizing the Concept of a “Behavior”
          2. Examining a Sample Extender
          3. Target Properties
        2. The ExtenderControl Class
          1. Generalities of Extender Controls
          2. The IExtenderControl Interface
        3. Creating a Sample Extender
          1. The FocusExtender Control
          2. Defining the Client Behavior
          3. The Extender’s Client Object Model
          4. Using the Focus Extender Control
      2. Introducing the AJAX Control Toolkit
        1. Get Ready for the Toolkit
          1. The ACT Project
          2. Adding ACT Components to the Toolbox
          3. Registering ACT Components with the Page
        2. What’s in the AJAX Control Toolkit
          1. Extenders in the ACT
          2. Controls in the ACT
      3. The Accordion Control
        1. Generalities of the Accordion Control
          1. Properties of the Control
          2. Animating the Control
          3. Sizing the Control
        2. Using the Accordion Control
          1. The Accordion Control in Action
          2. Accordion Panes
      4. The Rating Control
        1. Generalities of the Rating Control
          1. Properties of the Control
          2. Styling the Control
        2. Using the Rating Control
          1. The Rating Control in Action
          2. The Eventing Model
      5. The ReorderList Control
        1. Generalities of the ReorderList Control
          1. Properties of the Control
          2. Events of the Control
        2. Using the ReorderList Control
          1. Configuring the ReorderList Control
          2. Reordering and Postback Events
          3. Persisting Reordered Items
      6. The TabContainer Control
        1. Generalities of the TabContainer Control
          1. Properties of the Control
          2. Properties of Tab Panels
        2. Using the TabContainer Control
          1. Configuring the TabContainer Control
          2. Changing the Selected Tab
          3. The Client-Side Object Model
      7. AJAX Control Toolkit Extenders
        1. Panel Extenders
          1. The CollapsiblePanel Extender
          2. The DragPanel Extender
          3. The DropDown Extender
        2. Button Extenders
          1. The ConfirmButton Extender
          2. The MutuallyExclusiveCheckBox Extender
          3. The ToggleButton Extender
        3. Pop-up Extenders
          1. The HoverMenu Extender
          2. The ModalPopup Extender
          3. The PopupControl Extender
        4. User-Interface Extenders
          1. The AlwaysVisibleControl Extender
          2. The CascadingDropDown Extender
          3. The DropShadow Extender
          4. The DynamicPopulate Extender
          5. The PagingBulletedList Extender
          6. The ResizableControl Extender
          7. The RoundedCorners Extender
        5. Input Extenders
          1. The AutoComplete Extender
          2. The Calendar Extender
          3. The FilteredTextBox Extender
          4. The MaskedEdit Extender
          5. The NoBot Extender
          6. The NumericUpDown Extender
          7. The PasswordStrength Extender
          8. The Slider Extender
          9. The TextBoxWatermark Extender
          10. The ValidatorCallout Extender
        6. Animation Extenders
          1. The Animation Extender
          2. The UpdatePanelAnimation Extender
      8. Conclusion
  6. III. Client-Centric Development
    1. 6. Built-in Application Services
      1. Forms Authentication Services
        1. The System Infrastructure for Authentication
          1. The Client-Side Authentication Service Class
          2. The Server-Side Authentication Web Service
          3. The Programming Interface of the Service
          4. Configuration of the Authentication Service
        2. Using the Authentication Service in an Application
          1. The Login Process
          2. The Logout Process
          3. Typical User Interface Enhancements
          4. Design Guidelines for Protected Resources
      2. User Profiling Services
        1. The System Infrastructure for Profiling
          1. The Client-Side Profiling Service Class
          2. The Server-Side Profiling Web Service
          3. The Programming Interface of the Service
          4. Configuration of the Profiling Service
        2. Using the Profile Service in an Application
          1. Initializing a Profile-Enabled Page
          2. Loading the User Profile
          3. Updating the Profile
      3. Conclusion
    2. 7. Remote Method Calls with ASP.NET AJAX
      1. Designing the Server API for Remote Calls
        1. Defining the Contract of the Remote API
          1. The Contracted Interface
          2. What’s Coming Out with “Orcas”?
          3. Why Not WSDL and SOAP?
        2. Implementing the Contract of the Remote API
          1. Contract via Web Services
          2. Contract via Code-Behind Classes
          3. Publishing the Contract
      2. Remote Calls via Web Services
        1. Creating an AJAX Web Service
          1. The ScriptService Attribute
          2. The ScriptMethod Attribute
          3. Registering AJAX Web Services
          4. Configuring ASP.NET Applications to Host AJAX Web Services
        2. Consuming AJAX Web Services
          1. The Proxy Class
          2. Executing Remote Calls
          3. Error Handling
          4. Giving User Feedback
          5. Handling Timeouts
        3. Considerations for AJAX Web Services
          1. Why Local Web Services?
          2. Why JSON-Based Web Services?
          3. Runtime Support for JSON-Based Web Services
          4. Why Not WCF Services?
      3. Remote Calls via Page Methods
        1. Creating Page Methods
          1. Defining Page Methods
          2. Enabling Page Methods
          3. Runtime Support for Page Methods
          4. Why No Page Life Cycle?
        2. Consuming Page Methods
          1. The Proxy Class
          2. Executing Page Methods
          3. Page Methods vs. AJAX Web Services
      4. Bridging External Web Services
        1. Traditional Server-to-Server Approach
          1. Using .NET Proxies
          2. Using Plain Web Requests
        2. ASP.NET AJAX Futures Bridge Files
          1. Configuration and Setup
          2. The Bridge File
          3. Building a Bridge File for the Amazon Web Service
          4. Consuming Amazon Data through a Bridge
          5. Transforming the Web Service Response
      5. Conclusion
    3. 8. Building AJAX Applications with ASP.NET
      1. AJAX in Perspective
        1. The Benefits of AJAX
          1. AJAX Is a Real Breakthrough
          2. The Continuous Feel
          3. The User’s Experience and User Interface
        2. The Downsides of AJAX
          1. Comparing AJAX to Other Rich Clients
          2. Not Ready for Miracles as Yet
          3. Continuous Connection
          4. One-Page Application
        3. Patterns, Practices, and Services
          1. Services and Web Services
          2. REST vs. SOAP
          3. REST in ASP.NET AJAX
          4. Quick Tour of AJAX Patterns
      2. Revisiting ASP.NET Starter Kits
        1. The Jobs Site Starter Kit at a Glance
          1. Overview of JSSK
          2. Setting up for AJAX
        2. Reducing Page Flickering
          1. Adding the Script Manager
          2. Adjusting the Log-in Process
          3. Refactoring the Log-in Process
          4. Users Registration
          5. Searching for Jobs
          6. Posting a Resume
          7. Controlling Menus and Navigation
        3. Periodic Screen Refresh
          1. Refreshing on Postback
          2. Using Updatable Panels
          3. Using Server-Side Services
          4. Using Server Timers
          5. Using Client Timers
          6. Applying the Timeout Pattern
      3. Conclusion
  7. About the Author
  8. Additional Resources for Developers: Advanced Topics and Best Practices
  9. Additional Resources for C# Developers
  10. Additional SQL Server Resources for Developers
  11. Additional Resources for Web Developers
  12. Additional Resources for Developers
    1. Visual Basic 2005
    2. Visual C# 2005
    3. Web Development
    4. Data Access
    5. SQL Server 2005
    6. Other Developer Topics
  13. More Great Developer Resources
    1. Developer Step by Step
    2. Developer Reference
    3. Advanced Topics