Almost one year has elapsed since the release of the 1.0 version of ASP.NET AJAX. With the buzz created by the Ajax paradigm, the framework has gained a strong popularity among ASP.NET developers. The official ASP.NET AJAX website provides video tutorials, online documentation, and discussion forums. With all these resources available, one might think that a book would have little to contribute.
Our opinion is different. It’s true that the online documentation acts as a good, general reference. It’s also true that you can search the ASP.NET forums for the latest tips and tricks.
We believe that a strong comprehension of the new concepts and development techniques that ASP.NET AJAX brings to ASP.NET is fundamental in order to become proficient with the framework. What is the client page lifecycle? How does a partial postback work? Why do you need to write an Ajax-enabled control? One of the goals of this book is to explain how things work in ASP.NET AJAX. We also wanted to provide as much code as possible to show how to implement common Ajax scenarios with the help of ASP.NET AJAX.
Each chapter tries to explain the whys and hows of the concepts covered. We believe that simple examples are the way to go, so the reader can quickly start coding without losing the focus on ASP.NET AJAX concepts. Once the main concepts have been assimilated, we challenge the reader with more advanced examples.
We believe that Ajax development is client-oriented. As a consequence, six chapters of the book are entirely dedicated to the client-centric development model. Two of these chapters cover features that will be embedded in the next versions of the framework, and are currently provided as CTP (Community Technical Preview) material. Both the client-centric and the server-centric development models are discussed in great detail. As result, this book aims at giving you a deep and comprehensive knowledge of the ASP.NET AJAX Extensions framework.
This book is targeted at ASP.NET developers who want to master the ASP.NET AJAX Extensions. Even if we wrote this book with the beginner and intermediate developers in mind, the advanced developer could benefit from it, due to the new concepts and programming techniques brought to the ASP.NET world by the ASP.NET AJAX framework.
A little knowledge of the Ajax paradigm and the JavaScript programming language is desirable in order to fully understand the material presented in the book, but we do provide a good amount of background material in order for you to quickly become familiar with the concepts involved if you are a novice. We’d like to stress the fact that this book is specific to the ASP.NET AJAX framework, which is an implementation of many common Ajax patterns. Consequently, you won’t find a general and comprehensive discussion about Ajax and its techniques and patterns. If you’re new to the Ajax world, we strongly recommend reading an additional book about general Ajax concepts that is a framework-agnostic book. We particularly enjoyed reading Ajax in Action, written by Dave Crane, Eric Pascarello, and Darren James and published by Manning in October 2005.
This book is divided into four parts and is intended to guide you from the initial stages of developing with ASP.NET AJAX all the way to becoming an expert.
Part 1, which spans chapters 1–6, covers the basics of ASP.NET AJAX and its two development models, the server-centric development model and the client-centric development model. In these chapters, you’ll roll up your sleeves and become familiar with the essentials of Ajax programming and the ASP.NET AJAX infrastructure. You’ll learn about the components that make up the framework and how to use it effectively to enhance web applications.
Part 2 encompasses chapters 7–10 and goes deep into the development models by covering advanced scenarios and techniques. Prior to this, we’ll lay the groundwork for understanding the fundamentals of ASP.NET AJAX programming; but in this part it’s time to apply those lessons against challenging, real-life situations.
Part 3 is chapters 11 and 12. It highlights a set of features knows as the ASP.NET Futures. Here, we examine what is on the horizon for ASP.NET AJAX.
Part 4 consists of chapter 13. This chapter will help you become an ASP.NET AJAX master by implementing some of the most common Ajax patterns using the skills acquired from the previous chapters.
The approach we decided to follow in this book provides concepts and code rather than a reference manual. For this reason, we strongly recommend that you read all the chapters, because each chapter is built on the previous one and the complexity increases gradually. If you intend to focus on a specific development model, the following table suggests a possible division of the material covered in the book.
Chapter |
Title |
Client-centric developer |
Server-centric developer |
ASP.NET AJAX master |
---|---|---|---|---|
1 | Introducing ASP.NET AJAX | X | X | X |
2 | First steps with the Microsoft Ajax Library | X | X | |
3 | JavaScript for Ajax developers | X | X | |
4 | Exploring the Ajax server extensions | X | X | |
5 | Making asynchronous network calls | X | X | X |
6 | Partial-page rendering with UpdatePanels | X | X | |
7 | Under the hood of the UpdatePanel | X | X | |
8 | ASP.NET AJAX client components | X | X | |
9 | Building Ajax-enabled controls | X | X | |
10 | Developing with the Ajax Control Toolkit | X | X | |
11 | XML Script | X | X | |
12 | Dragging and dropping | X | X | |
13 | Implementing common Ajax patterns | X | X | X |
Chapter 1 introduces Ajax and the ASP.NET AJAX extensions to the ASP.NET developer. Together with the foundations and the terminology, we present the server-centric and client-centric development models. With the client-centric model, you can develop Ajax applications by leveraging DHTML and JavaScript without relying on the ASP.NET server technology. With the server-centric model, you can take advantage of ASP.NET capabilities to combine client functionality with ASP.NET server controls.
After we’ve established the foundations and provided a whirlwind tour of features, chapters 2 and 3 cover the Microsoft Ajax Library, which is the client portion of the ASP.NET AJAX framework. In chapter 2, we’ll explain some basic concepts such as the application model and the client page lifecycle, as well as provide an overview of all the features provided by the library. In chapter 3, we’ll focus specifically on object-oriented programming with JavaScript and the Microsoft Ajax Library. After reviewing the basics of the JavaScript language and JSON, we’ll go deep into the object-oriented constructs provided by the Microsoft Ajax Library.
Chapter 4 tackles a common scenario that many ASP.NET developers will encounter: upgrading an existing ASP.NET application to ASP.NET AJAX. In this chapter, you’ll learn how a new collection of server controls called the Ajax server extensions can help you gracefully and easily enhance an existing application.
After some reinforcement about the server-centric model in the previous chapter, chapter 5 delves into a key pillar of Ajax development: the ability to make asynchronous network requests from the browser to the server. In this thorough chapter, we cover in detail topics such as working with ASP.NET Web Services, ASP.NET application services such as authentication and profile, and the bridge technology.
The next few chapters focus primarily on the UpdatePanel control and the partial-page rendering mechanism. Beginning with chapter 6, we explain how to use the UpdatePanel correctly and efficiently. Chapter 7 unveils how the partial-page rending mechanism works under the hood and provides insight into how you can take more control of the application during the process.
In chapter 8, we’ll return to the Microsoft Ajax Library to examine the client component model. With this model, which is similar to the one used in the .NET framework on the server side, you can create components using JavaScript. Components let you easily encapsulate and reuse portions of client-side code, and they simplify the development of Ajax-enabled server controls.
We cover Ajax-enabled controls in chapter 9, which explains how to combine client components with ASP.NET server controls in order to enrich them with client functionality. In this chapter, you’ll learn how to build extenders and script controls, the two new categories of server controls introduced by ASP.NET AJAX.
Chapter 10 is dedicated to the Ajax Control Toolkit, which is the biggest collection of Ajax-enabled controls available at present. The Toolkit is an open-source project owned by Microsoft and open to contributions from the community. In the chapter, we’ll discuss some of the Ajax-enabled controls shipped with the Ajax Control Toolkit. We’ll also introduce the Toolkit API for developing Ajax-enabled controls, as well as the Animation framework for easily creating animations and visual effects.
Chapters 11 and 12 explore the future of ASP.NET AJAX. We’ll cover in detail some of the features that will be included in the next versions of ASP.NET AJAX. These features are, at present, shipped as evaluation code in a separate package called ASP.NET Futures. In chapter 11, we’ll cover XML Script, which is a declarative language, similar to the ASP.NET markup code, used for instantiating client components in a web page. You can use it to execute complex client-side code without writing a single line of JavaScript. Chapter 12 is dedicated to the drag-and-drop engine, which makes it possible to drag and drop DOM elements in a web page. In this chapter, you’ll build a drag-and-drop–enabled shopping cart from scratch by leveraging both the client-centric and the server-centric development models.
Finally, chapter 13 shows you how to implement some of the most common and useful Ajax patterns using the ASP.NET AJAX framework. In addition to implementing classic patterns such as drag-and-drop widgets and logical navigation, we’ve decided to give space to coding patterns as well. Chapter 13 covers advanced scenarios such as writing debug versions of script files and extending the Microsoft Ajax Library to become even more productive with JavaScript.
Appendixes A and B are dedicated to the setup of the tools needed to install and use ASP.NET AJAX. Appendix A covers the installation of both the ASP.NET AJAX framework and the Ajax Control Toolkit. It also shows you how to install the Visual Studio templates and how to add server controls to the Visual Studio Toolbox. A section is dedicated to the installation of the AdventureWorks database, which is used in some of the examples presented in the book.
Appendix B covers some of the tools that are a must-have for an Ajax developer. It explains how to install and use Firebug to debug web applications in the Firefox browser. You’ll also learn how to install and use Web Development Helper and Fiddler to access the browser’s console and debug HTTP traffic. The final section shows you how to configure Visual Studio 2005 for the purpose of debugging the JavaScript code.
The following typographical conventions appear throughout the book:
In the book, we use special paragraphs to highlight topics for further exploration of ASP.NET AJAX and the .NET Framework. Here’s an example:
These paragraphs provide additional details about the .NET Framework or sources of additional information accessible from the Internet. The URL addresses shown in these paragraphs were valid as of August 1, 2007.
All source code for the programs presented in ASP.NET AJAX in Action is available to purchasers of the book from the Manning website. Visit the site at www.manning.com/gallo or www.manning.com/ASPNETAJAXinAction for instructions on downloading the code.
Free access to a private Internet forum, Author Online, is included with the purchase of this book. Visit the website for detailed rules about the forum, to subscribe to and access the forum, to retrieve the code for each chapter and section, and to view updates and corrections to the material in the book. You are invited to make comments, good or bad, about the book, ask technical questions, and receive help from the authors and other ASP.NET AJAX programmers. The forum is available at the book’s website at www.manning.com/gallo or www.manning.com/ASPNETAJAXinAction.
Manning’s commitment to readers is to provide a venue where a meaningful dialogue among individual readers and among readers and the authors can take place. It isn’t a commitment to any specific amount of participation on the part of the authors, whose contribution remains voluntary (and unpaid). So please keep the questions and comments interesting!
Alessandro can be contacted directly at [email protected] or through his blog at aspadvice.com/blogs/garbin.
David can be contacted directly at [email protected] or through his blog at weblogs.asp.net/davidbarkol.
Rama can be contacted directly at [email protected].
18.223.195.164