Advanced ASP.NET AJAX Server Controls, For .NET Framework 3.5 (2009)

Advanced ASP.NET AJAX Server Controls, For .NET Framework 3.5 (2009)

(Parte 3 de 5)

It’s not actually part of ASP.NET AJAX, but because it provides so many great server and extender controls, it’s invaluable to the ASP.NET AJAX community. Creating new extender controls through it is a topic we cover fully.

Book Breakdown

The book is divided into four major parts. In the first part, we focus on the basics of the Microsoft AJAX Library and JavaScript, the programming language that powers it. We call this part “Client Code.” In the second part, we focus on a creating distributable AJAX-enabled controls, and we call this part “Controls.” In the third part, called “Communication,” we focus on the different ways your client control can communicate with the server. Finally, in the fourth part, we focus on the AJAX Control Toolkit, a slightly higherlevel model of creating AJAX-enabled server controls. This final part is aptly named “AJAX Control Toolkit.”

Client Code Chapter 1, “Programming with JavaScript,” focuses on JavaScript, the programming language that powers the Microsoft AJAX Library. We spend a

Prefacexxx full chapter on JavaScript because so many developers (ourselves included) have glossed over key details when working with the language; and because you’re going to be writing so much JavaScript to AJAX-enable your server controls, a solid background is important.

In Chapter 2, “Microsoft AJAX Library Programming,” we continue where we left off in Chapter 1 by taking a look at how the Microsoft AJAX Library builds on JavaScript to provide a programming platform a .NET developer will find familiar.

Controls Starting in Chapter 3, “Components,” we begin our path to creating fully encapsulated AJAX-enabled controls by learning how to use and derive from three key client types: components, controls, and behaviors. We talk theory and provide a couple of practical examples.

In Chapter 4, “Sys.Application,” we cover maybe the most important portion of the Microsoft AJAX Library as we discuss Sys.Applicationand how it acts like a client runtime with which we can interact.

In Chapter 5, “Adding Client Capabilities to Server Controls,” we bring the server into the mix when we cover how to create server components that automatically create corresponding components.

In Chapter 6, “ASP.NET AJAX Localization,” we continue adding control capabilities with an in-depth examination of localization in ASP.NET AJAX.

Finally, in Chapter 7, “Control Development in a Partial Postback Environment,” we wrap up the “Controls” part with a look at the concerns surrounding how the UpdatePanelaffects control development.

Communication With Chapter 8, “ASP.NET AJAX Communication Architecture,” we start looking at communication in ASP.NET AJAX using Windows Communication Foundation (WCF) services, page methods, and the client web service proxies.

In Chapter 9, “Application Services,” we cover the application services and include a demonstration of how to build your own application service.

Preface xxxi

AJAX Control Toolkit Beginning with Chapter 10, “ASP.NET AJAX Control Toolkit Architecture,” we start our look at the AJAX Control Toolkit. We cover the base classes that are used by toolkit controls and the support and designer classes that provide additional features.

Finally, we conclude the book with Chapter 1, “Adding Client Capabilities to Server Controls Using the ASP.NET AJAX Control Toolkit,” as we attach client capabilities to server controls using the AJAX Control Toolkit. This chapter includes how to build a new extender control and provide design-time features for it.

What Is Not Covered?

You might find it strange to see a note that talks about what we’re not covering. We’re including it for two reasons.

First, this book covers a pretty narrow topic when compared to

ASP.NET AJAX at large. Because of this, we don’t have the normal introductory chapter where we walk you through the basics or history of ASP.NET AJAX. Instead, we’re making the assumption, good or bad, that you’ve got some ASP.NET AJAX knowledge under your belt. If you don’t, don’t worry; getting your ASP.NET AJAX knowledge to the point where you feel comfortable doesn’t take long, and this book will pick up right where that basic knowledge leaves off. For this type of information, the Microsoft ASP.NET AJAX website located at http://asp.net/ajax is an excellent source.

Second, we’re leaving out a familiar ASP.NET AJAX subject, and we wanted a chance to tell you and defend our decision before we got too far. This is something that we’ve repeatedly debated between the two of us and asked many colleagues for their opinion and was a decision that we didn’t come to easily.

There are no chapters in which we cover how to use the UpdatePanel server control.

Okay, you haven’t closed the book? Good. Let us explain how and why we came to this decision.

Prefacexxxii

Simply put, the UpdatePanelis a server control. It comes with ASP.NET

AJAX and provides a quick and dirty way to refresh a portion of a page such that the page goes through its normal lifecycle, but doesn’t refresh the entire page when the page processing is done. Using it, we don’t have to alter the way we’ve been programming web pages since ASP.NET 1.0 came out. This is a good thing and was a “quick win” for Microsoft. It allowed ASP.NET AJAX to be adopted quickly by ASP.NET developers and provided a unique advantage against other AJAX frameworks.

However, the UpdatePanelis just a server control and it’s developed in such a way that it doesn’t have a whole lot of comparative properties with the type of ASP.NET AJAX server control development we’re covering.

We’re not saying it’s not an important server control and that it has no place in the AJAX world. Rather, it is an extremely valuable tool whose complexity and correct usage is worthy of a small book; just not this one.

Finally, although we do not cover how to use the UpdatePanel, we do cover how to create server controls so that they work correctly in an UpdatePanel, or more specifically a partial-postback, environment. We expect that you want your new server controls to work in any ASP.NET environment, and a partial-postback environment is no exception. The partial-postback environment, however, requires us to use some different methods, the new ScriptManager.RegisterXXXmethods being the most common, and take some care in how we create our server controls. So, we’ve dedicated Chapter 7 to this topic.

Why Just Server Controls?

Writing a book on just server controls allows us to delve deeply into a narrow topic that is extremely important to web application developers. The ASP.NET AJAX books currently available all generally focus on the technology as a whole. Because they cover a broad range of topics, giving a taste of everything, they have trouble really getting into how certain parts of ASP.NET AJAX work and tend to give shallow coverage of topics that we think are key to creating server controls. It’s been our experience that developers tend to move past the content of the more general books fairly

Preface xi quickly because nonbasic situations arise almost immediately when working on a real-life web application.

Target Audience

This book is primarily targeted at the experienced ASP.NET developer who has developed custom web server controls. We expect that you’re reading this book to enhance your already proficient ASP.NET development skill set with new ASP.NET AJAX skills. The applications you develop demand elegance and professionalism and easy maintenance and scalability, so you tend to use server controls to your advantage wherever possible.

Besides your experience with ASP.NET, we expect that you’re familiar with JavaScript and the basics of ASP.NET AJAX. Therefore, we don’t cover how to set up a new ASP.NET AJAX-enabled web application, and although we do cover JavaScript, we start our coverage at a level where we assume some existing knowledge.

Our goal is to provide you with the tools you need to build reusable

ASP.NET AJAX server controls or AJAX Control Toolkit extender controls. Our feeling is that reasonably knowledgeable ASP.NET developers will be able to learn the skills necessary to create new ASP.NET AJAX server controls through this book and then add that skill to their ASP.NET development tool bag.

Prerequisites

This book requires ASP.NET 3.5 AJAX and Visual Studio 2008. We heavily cover features included in ASP.NET 3.5 AJAX not included in ASP.NET 2.0 AJAX and C#’s and Visual Studio 2008’s new capabilities such as automatic properties and JavaScript IntelliSense.

Source Code

The source code for the book’s examples can be found on the book’s website: w.informit.com/title/9780321514448.

Prefacexxxiv

Acknowledgments

WEARETOTALLYAMAZEDATHOWmuch effort it took so many people to make this book. From the editor to the technical reviewers, copy editors, and marketing folks, there are a lot of people responsible for creating a quality book other than the authors.

We first want to thank all our technical reviewers: Joe Stagner, Jason

Schmitt, Milan Negovan, and Russel Gauthier. This book wouldn’t be anywhere near as good as it is without the massive time and effort you put into each chapter. The early drafts were rough, real rough, and your reviews let us know it. If you hadn’t been so truthful, we would have thought that what we had written was ready to publish, which would have been a huge mistake. Your ability to take all our jumbled thoughts and see what we were trying to say and put us on the path to a comprehensible, useful book is simply amazing. There is no way we could have done this without every piece of input you provided.

We also want to thank our project editor, Jovana San Nicolas-Shirley, for letting us make last-minute changes and answering all our seemingly endless questions (and those we have still yet to ask!).

Also, we want to thank our copy editor, Keith Cline, for asking for clarifications when our writing was unclear, correcting our errant grammar, and making us sound like seasoned writers (when we’re really not!).

Aspecial thanks goes out to our marketing team of Curt Johnson, Nancy Valentine, and Andrea Bledsoe for getting our book out to the public.

xxxv

We also want to thank Joan Murray, our wonderful editor who not only guided two brand new authors through their first book-writing experience, but also managed to have a baby during it all. Congratulations again, and thanks for providing all the support and leeway we needed to craft a quality book.

Thanks also to everyone else at Addison-Wesley who has worked on the book, including Emily Frey, our temporary editor; Kristy Hart and Sheri Cain, who performed early development edits; Karen Opal, who got us into the Library of Congress; and everyone else who we’ve either forgotten or didn’t know about!

From Adam First, I want to thank my coauthor, Joel, for his never-ending pursuit of excellence, both professionally and personally. Our endless discussions about technology and life in general made writing this book a truly awesome experience. I also want to thank the great team at InterKnowlogy for providing an environment that motivates someone to keep pursuing his technical passions. The cutting-edge work that InterKnowlogy continues to attract makes it a most challenging and exciting place to work.

From Joel Although this book is dedicated to my wife, Stacey, I want to acknowledge her here, too. We share an office at home and spent countless hours together while she studied for licensing exams and I wrote. There is no way that I would have stayed sane if you had not been there to break the monotony and distract me when I got frustrated. Bouncing ideas and analogies off of you was one of the most fun aspects of writing this book. You truly are an amazing woman, a wonderful wife, an accomplished professional, and a fantastic officemate.

Although my wife was my officemate for most evenings and weekends of the past year, this book wouldn’t have happened and I wouldn’t be as advanced in my career as I am without my coauthor, Adam. Adam approached me to coauthor this book when we worked together at Inter- Knowlogy because I had shown a greater interest in the technology than required to just get the job done. Because I was really into the technology,

Acknowledgment sxxxvi but more because I respect him so much both as a professional and a person, I was immediately onboard. Although I left InterKnowlogy shortly after we started the book, our personal and professional relationship has only gotten stronger; and without his leadership, dedication, technical knowledge, and industry connections, this book would have never gotten very far nor be nearly as good as it is. Thanks, Adam, for putting up with my endless phone calls, circular ideas, and overall pain-in-the-ass self.

My parents: Mom and Dad. Who would’ve thought that I would actually end up 50 percent Mom and 50 percent Dad? Dad, your “don’t guess, think” advice when I was programming Pascal in high school taught me to step back from a problem. Mom, the endless hours you dedicated working with me on my reports, essays, and papers has made me a halfway decent writer and not scared of the copy editor’s red pen. Also, previous opportunities I had to write for you instilled confidence in me that I could do this.

Keri, Seth, Riley, and Cameron. Thanks for always asking about the book and encouraging me. Remember, it’l make a good bedtime story for the kids, and I’m sure it’l put you to sleep, too.

All the developers at the CoStar Group, especially my teammates Jason,

Louise, and John. You guys have helped me grow as a developer and a team member, and together we delivered a mapping solution second to none. I’m sure the coming years will be as rewarding as the past one as we branch into new uncharted territories.

Finally, to all my friends who have shared a beer with me in the past 14 months and heard me either cheer in happiness for completing a milestone or curse an upcoming deadline, thanks. Believe it or not, your support throughout this whole process has meant a lot to me.

Acknowledgment s xxxvii

About the Authors

Adam Calderonis a C# MVPand the Application Development Practice Lead at InterKnowlogy. He is an accomplished software developer, author, teacher, and speaker with more than 14 years of experience designing and developing solutions on the Microsoft platform. His involvement with ASP.NET AJAX began in late 2005 with his participation in the ASP.NET ATLAS First Access program and later as a member of the UI Server Frameworks Advisory Council. Adam was one of the fortunate few who were able to work on a production application that utilized ASP.NET AJAX in its alpha form and experienced firsthand the trials and tribulations of working in “beta land” on this exciting technology. Visit Adam’s blog at http://blogs.interknowlogy.com/adamcalderon.

Joel Rumermanis a Senior .NET Developer at the CoStar Group, where he develops ASP.NET applications to support the company’s commercial real estate information business. He is an adept software developer with more than eight years of experience developing .NET applications and is active in the San Diego .NET community as an author and speaker. Joel has been working with ASP.NET AJAX since late 2005 when he started work on a large-scale application for a worldwide independent software vendor. This initial entry into the ASP.NET AJAX world provided him invaluable experience as he worked closely with Microsoft as a member of the ATLAS First Access program and participated in a Strategic Design Review of the technology. Joel has gone on to implement many more solutions using ASP.NET AJAX, including a Virtual Earth mash-up that maps commercial real estate properties. Visit Joel’s blog at http://seejoelprogram.wordpress.com.

(Parte 3 de 5)

Comentários