OReilly.Programming.ASP.NET.AJAX.Sep.2007

475 435 3
OReilly.Programming.ASP.NET.AJAX.Sep.2007

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

OReilly.Programming.ASP.NET.AJAX.Sep.2007

Programming ASP.NET AJAX Other Microsoft Windows resources from O’ReillyRelated titlesEssential SharePoint 2007Learning ASP.NET 2.0 withAJAXLearning C# 2008Programming WPFSharePoint 2007:The Definitive GuideWindows Vista:The Definitive GuideWindows Vista in a NutshellWindows BooksResource Centerwindows.oreilly.com is a complete catalog of O’Reilly’s Win-dows and Office books, including sample chapters and codeexamples.oreillynet.com is the essential portal for developers interested inopen and emerging technologies, including new platforms, pro-gramming languages, and operating systems.ConferencesO’Reilly brings diverse innovators together to nurture the ideasthat spark revolutionary industries. We specialize in document-ing the latest tools and systems, translating the innovator’sknowledge into useful skills for those in the trenches. Visitconferences.oreilly.com for our upcoming events.Safari Bookshelf (safari.oreilly.com) is the premier online refer-ence library for programmers and IT professionals. Conductsearches across more than 1,000 books. Subscribers can zero inon answers to time-critical questions in a matter of seconds.Read the books on your Bookshelf from cover to cover or sim-ply flip to the page you need. Try it today for free. Programming ASP.NET AJAXChristian WenzBeijing•Cambridge•Farnham•Köln•Paris•Sebastopol•Taipei•Tokyo Programming ASP.NET AJAXby Christian WenzCopyright © 2007 Christian Wenz. All rights reserved.Printed in the United States of America.Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.O’Reilly books may be purchased for educational, business, or sales promotional use. Online editionsare also available for most titles (safari.oreilly.com). For more information, contact ourcorporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com.Editor:John OsbornTechnical Editor:Mike PopeProduction Editor:Rachel MonaghanProduction Services:Octal Publishing, Inc.Cover Designer:Karen MontgomeryInterior Designer:David FutatoIllustrators:Robert Romano andJessamyn ReadPrinting History:September 2007: First Edition.Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks ofO’Reilly Media, Inc. Programming ASP.NET AJAX, the image of a murex, and related trade dress aretrademarks of O’Reilly Media, Inc.Many of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of atrademark claim, the designations have been printed in caps or initial caps.While every precaution has been taken in the preparation of this book, the publisher and author assumeno responsibility for errors or omissions, or for damages resulting from the use of the informationcontained herein.This book uses RepKover™, a durable and flexible lay-flat binding.ISBN-10: 0-596-51424-7ISBN-13: 978-0-596-51424-2[M] vTable of ContentsPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiPart I. Basics1. ASP.NET AJAX, Ajax, and ASP.NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3ASP.NET AJAX and Ajax 3ASP.NET AJAX and ASP.NET 5ASP.NET AJAX Prerequisites and Installation 6ASP.NET AJAX Structure and Architecture 12A First ASP.NET AJAX Example: Hello User 14The ScriptManager Control 19Summary 21For Further Reading 212. JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22The JavaScript Language 24Object-Oriented Programming (OOP) 34Accessing Page Elements 38DOM Methods 42Summary 43For Further Reading 433. Ajax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44The XMLHttpRequest Object 45The XMLDocument Object 55JSON 61Summary 64For Further Reading 64 vi | Table of ContentsPart II. ASP.NET AJAX Extensions4. Using ASP.NET AJAX JavaScript Extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . .67ASP.NET AJAX Shortcuts and Helper Functions 67Extensions to Existing JavaScript Objects 70ASP.NET AJAX OOP Features for JavaScript 71Client Versions of .NET Classes 83Summary 87For Further Reading 875. Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88Error Handling 88Page Methods 93Maintaining Session State 95Exchanging Complex Data with the Server 100Consuming Web Services with JavaScript 105Summary 114For Further Reading 1156. UpdatePanel: Refreshing Only Parts of a Page. . . . . . . . . . . . . . . . . . . . . . . .116Making a Page Region Updatable 116Summary 131For Further Reading 1327. Using the ASP.NET AJAX Profile Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133Preparing the Web Site 133Accessing Profile Data 135Accessing Profile Group Data 139Summary 144For Further Reading 1448. Using the ASP.NET AJAX Authentication Service. . . . . . . . . . . . . . . . . . . . . . .145Preparing the Application 145Login and Logout 148Summary 154For Further Reading 154 Table of Contents | vii9. Localizing and Globalizing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155Localization 156Globalization and Internationalization 169Summary 173For Further Reading 173Part III. ASP.NET AJAX Control Toolkit10. Using the Control Toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177Installing the Control Toolkit 177Using the Control Toolkit 181Summary 184For Further Reading 18411. Adding Animation to a Web Page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185Animation Framework 185Drag-and-Drop 193Summary 195For Further Reading 19612. Autocompleting User Input, Fighting Spam, and More . . . . . . . . . . . . . . . .197Creating an Accordion Pane 197Maintaining the Relative Position of an Element 199Adding Autocomplete Behavior to a TextBox Control 201Attaching a Calendar to a Text Field 208Dynamically Collapsing a Single Panel 210Displaying a Pop Up Over a Page 211Fighting Spam in Blogs and in Other Entry Forms 214Creating a Tabbed Interface 216Summary 218For Further Reading 21813. Writing Custom Controls and Contributing to the Community . . . . . . . . . .219Writing Custom ASP.NET AJAX Controls 219Contributing to the Control Toolkit 228Summary 237For Further Reading 237 viii | Table of ContentsPart IV. ASP.NET AJAX Futures14. Client Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241Introducing ASP.NET AJAX Client Controls 241Using ASP.NET AJAX Controls 242Handling Control Events 259Summary 263For Further Reading 26315. Binding and Validating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .264Data Binding 264Data Validation 280Summary 296For Further Reading 29616. Using Behaviors and Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .297Using Behaviors 297Using Components 310Summary 313For Further Reading 31317. Using Server Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314Using a ListView Control 314Creating a Custom Data Source 330Summary 336For Further Reading 33618. Using Remote Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337Using the Google Web Service 338Using the Amazon Web Service 345Transforming a Web Service Result with XSLT 350Using the Yahoo! Web Service (and REST and XPath) 358Summary 367For Further Reading 36719. Using Animations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .368Using Animations 368Using an Animation to Create a Fade Effect 370 Table of Contents | ixSummary 380For Further Reading 38020. Fixing Bookmarks and Back/Forward Buttons . . . . . . . . . . . . . . . . . . . . . . . .381Fixing with Code 382Fixing Bookmarks and Back/Forward Buttons with Controls UsingUpdateHistory 384Fixing Bookmarks and Back/Forward Buttons with Controls Using theASP.NET AJAX Futures 388Summary 395For Further Reading 39521. Web Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396Using ASP.NET AJAX with ASP.NET Web Parts 396Summary 401For Further Reading 401Part V. Microsoft AJAX Library22. Using ASP.NET AJAX with Other Server Technologies. . . . . . . . . . . . . . . . . . .405Using ASP.NET AJAX with PHP 406Summary 409For Further Reading 410Part VI. AppendixesA. Debugging ASP.NET AJAX Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .413B. XMLHttpRequest Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .426C. DOM Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .428D. ASP.NET AJAX Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .432E. ScriptManager, UpdatePanel, UpdateProgress, and TimerDeclarative Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .435Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .439 . Basics1. ASP. NET AJAX, Ajax, and ASP. NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3ASP. NET AJAX and Ajax 3ASP. NET AJAX and ASP. NET. OrganizedChapter 1, ASP. NET AJAX, Ajax, and ASP. NET, gives a broad overview of Ajax andthe ASP. NET AJAX framework and then covers the installation of ASP. NET AJAX, areview

Ngày đăng: 15/11/2012, 14:24

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan