 |
Learning ASP.NET 2.0 with AJAX
Read an excerpt:
Chapter 4: Saving and Retrieving Data
Excerpt provided courtesy of O'Reilly Media. Copyright © O'Reilly Media, Inc. Written permission from the publisher is required for any use of this material.
|
Be the First to Write a Review and tell the world about this title!People who purchase this book frequently purchase: - ASP.NET 3.5 Unleashed (Stock Expected July 8th); Stephen Walther, $32.95, 45% Off!
- High Performance Web Sites; Steve Souders, $18.50, 38% Off!
- Programming Collective Intelligence: Building Smart Web 2.0 Applications; Toby Segaran, $24.95, 38% Off!
- C# 3.0 in a Nutshell, 3rd Edition; Joseph Albahari, et al, $30.95, 38% Off!
Books on similar topics, in best-seller order:Books from the same publisher, in best-seller order:
With this book, web developers can build engaging and interactive sites and
applications using Microsoft's latest web development tools -- ASP.NET 2.0 and
the new ASP.NET AJAX framework. You learn to create applications that have all
the great tricks you see on popular commercial web sites, such as order forms
and the ability to interact with a database. And you can build pages that display
information interactively without a page refresh. This straightforward tutorial
explains how.
Learning ASP.NET 2.0 with AJAX helps you master the concepts and techniques
of Microsoft's tools with plenty of annotated examples, review quizzes, web
construction exercises and chapter summaries, so you can practice new skills
and test your understanding as you go. With it, you'll learn to:
- Master the fundamental skills of ASP.NET 2.0 to build professional quality
web applications
- Integrate new Ajax tools and CSS with ASP.NET 2.0 for flashier and more
interactive sites
- Build applications with minimal coding using Visual Studio or its free counterpart,
Visual Web Developer
- Connect your site with a database so that users can retrieve, interact and
save data
- Debug your application, deal with unexpected problems, and protect your
site from malicious users
- Use the community-maintained ASP.NET AJAX Control Toolkit to extend the
controls that come with ASP.NET AJAX
- Use personalization tools to give your site a customized look for each user
Ideal for beginning web developers, or those who are new to ASP.NET, this book
gets you involved with your own learning through hands-on lessons that are clear
and to the point. You get the chance to try out new techniques on the spot.
Want to join the world of modern web development? This book will get you started.
Table of Contents
Cheat Sheets
Preface
1. Getting Started
Hello World
Creating a New Web Site
Creating HelloWorld
Making the HelloWorld Web Site Interactive
What You Just Did
Summary Brain Builder 15
2. Building Web Applications
Mastering Web Site Fundamentals
The Page
Controls
Code-Behind Files
Events and Postbacks
Synchronous and Asynchronous Postbacks
The Page Load event and synchronous postback
Adding asynchronous postbacks
Controls
Organizing the Properties Window
Finding properties with IntelliSense
Basic Controls
Creating Tables
Setting Properties
Selection Controls
Panels
Selection Controls
Adding controls with the Item editor
Adding items in Source View
More Selection Controls
Displaying Text
Images
Links
LinkButtons
Source Code
Summary Brain Builder 61
3. Snappier Web Sites with AJAX
Take a Walk on the Client Side
ScriptManager
Extending Controls with the Control Toolkit
TextBoxWaterMarkExtender
PopupControlExtender
CollapsiblePanelExtender
Source Code Listing
Summary Brain Builder 93
4. Saving and Retrieving Data
Getting Data from a Database
Binding Data Controls
Create a Sample Web Page
Using a DataSource Control
"Pay No Attention to That Man Behind the Curtain"
Using the GridView Control
Auto-Generated Code
Adding Insert, Update, and Delete Statements
Displaying and Updating the Data
Take It for a Spin
Modifying the Grid Based on Events
Selecting Data from the GridView
Passing Parameters to the SELECT Query
Source Code Listings
Summary Brain Builder 137
5. Validation
Validation Controls
The RequiredFieldValidator
The Summary Control
The Compare Validator
Checking the Input Type
Comparing to Another Control
Range Checking
Regular Expressions
Custom Validation
Summary Brain Builder 166
6. Style Sheets, Master Pages, and Navigation
Styles and Style Sheets
Cascading Style Sheets
Inline Styles
Pros and cons
Document-Level Styles
Pros and cons
External Style Sheets
Master Pages
Creating a Master Page
Adding Content Pages
Using Nested Master Pages
Changing the Master Page at Runtime
Navigation
Buttons and HyperLinks
Menus and Bread Crumbs
Site Maps
Using Sitemaps
TreeView
Customizing the look and feel of the TreeView
Replacing the TreeView with a menu control
Accessing site map nodes programmatically
Bread Crumbs
Summary Brain Builder 217
7. State and Life Cycle
Page Life Cycle
State
View State
Session State
Application State
Summary Brain Builder 247
8. Errors, Exceptions, and Bugs, Oh My!
Creating the Sample Application
Tracing
Page-Level Tracing
Inserting into the Trace Log
Debugging
The Debug Toolbar
Breakpoints
Setting a breakpoint
Breakpoint window
Breakpoint properties
Breakpoint icons
Stepping Through Code
Examining Variables and Objects
Debug Windows
Immediate window
Locals window
Watch window
Call Stack window
Error Handling
Unhandled Errors
Application-Wide Error Pages
Page-Specific Error Pages
Summary Brain Builder 280
9. Security and Personalization
Forms-Based Security
Creating Users with the WAT
Managing Users Programmatically
Creating user accounts
Creating a welcome page
Creating a login page
Roles
Restricting Access
Testing for login status
Testing for role-based authentication membership
Personalization
Profiles
Simple data types
Complex data types
Anonymous Personalization
Migrating anonymous data to an actual user's record
Themes and Skins
Create the Test Site
Organize Site Themes and Skins
Enable Themes and Skins
Specify Themes for Your Page
Using Named Skins
Summary Brain Builder 335
10. Putting It All Together
Getting Started
Adding Styles
Using Master Pages
Setting Up Roles and Users
Logging In
Navigation
Products Page
Adding AJAX
Cart Page
Purchase Page
Confirm Page
Custom Error Pages
Summary
Source Code Listings
Cart Page
Confirm Page
Home Page
Login Page
Master Page
Products Page
Purchase Page
Web.config
A. Installing the Applications
B. Copying a Web Site
C. Answers to Quizzes and Exercises
Index
About the Author
Jesse Liberty is the best-selling author of O'Reilly Media's Learning ASP.NET
with AJAX, Programming C#, Programming .NET 3.5, and a dozen other books on
programming. He is a Senior Program Manager at Microsoft on the Silverlight
Development Team, and a frequent contributor to O'Reilly Network websites and
publications. Jesse is a former Distinguished Software Engineer at AT&T
and Vice President for technology development at CitiBank, and was an independent
consultant for 12 years.
|
 |