Home > Store

ASP.NET 4 Unleashed

Register your product to gain access to bonus material or receive a coupon.

ASP.NET 4 Unleashed


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2011
  • Dimensions: 7" x 9-1/8"
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-33112-8
  • ISBN-13: 978-0-672-33112-1

The most comprehensive book on Microsoft’s new ASP.NET 4, ASP.NET 4 Unleashed covers all facets of ASP.NET development. Led by Microsoft ASP.NET program manager Stephen Walther, an expert author team thoroughly covers the entire platform.

The authors first introduce the ASP.NET Framework’s basic controls and show how to create common site-wide layouts and styles. Next, they cover all aspects of accessing, presenting, organizing, and editing data. You’ll find thorough and practical sections on building custom components and controls, providing effective site navigation, securing sites and applications, and much more. This book presents hundreds of realistic code examples, reflecting the authors’ unsurpassed experience with ASP.NET both inside and outside Microsoft.

  • Build interactive Web Forms, validate form data, and upload files
  • Provide interactive calendars, wizards, site maps, and other valuable features
  • Design efficient, maintainable sites with Master Pages and Themes
  • Build data-driven applications with database controls, ADO.NET data access components, QueryExtender, LINQ to SQL, and WCF Data Services
  • Generate charts on the fly with the new Chart Control
  • Extend ASP.NET with custom controls and reusable components
  • Create site registration and authentication systems that store membership data in SQL Server or Active Directory
  • Use URL Routing to build dynamism, flexibility, readability, and SEO-friendliness into your URLs
  • Improve performance and scalability with caching and preloading
  • Maintain state with cookies, cookieless session state, and profiles
  • Localize, configure, package, and deploy ASP.NET applications
  • Use the ASP.NET MVC Framework to improve agility, testability, speed to market, and extensibility
  • Retrofit existing ASP.NET applications with Ajax and build pure client-side Ajax web applications
  • Construct a complete ASP.NET 4 website from start to finish

Sample Content

Online Sample Chapter

Overview of the ASP.NET Framework

Sample Pages

Download the sample pages (includes Chapter 1 and Index)

Table of Contents

Introduction     1

Part I   Building ASP.NET Pages

1   Overview of the ASP.NET Framework     5

ASP.NET and the .NET Framework     9

Understanding the Framework Class Library     9

Understanding the Common Language Runtime     17

Understanding ASP.NET Controls     19

Overview of ASP.NET Controls     19

Understanding HTML Controls     21

Understanding and Handling Control Events     22

Understanding View State     28

Understanding ASP.NET Pages     34

Understanding Dynamic Compilation     34

Understanding Control Trees     38

Using Code-Behind Pages     39

Handling Page Events     44

Using the Page.IsPostBack Property      46

Debugging and Tracing ASP.NET Pages     48

Tracing Page Execution     52

Installing ASP.NET     55

Summary     57

2   Using the Standard Controls     59

Displaying Information      59

Using the Label Control      60

Using the Literal Control      65

Accepting User Input     68

Using the TextBox Control     68

Using the CheckBox Control     76

Using the RadioButton Control     79

Submitting Form Data     84

Using the Button Control     84

Using the LinkButton Control     86

Using the ImageButton Control     89

Using Client Scripts with Button Controls     94

Performing Cross-Page Posts     96

Specifying a Default Button     100

Handling the Command Event     101

Displaying Images     104

Using the Image Control     104

Using the ImageMap Control     106

Using the Panel Control     111

Using the HyperLink Control     118

Summary      119

3   Using the Validation Controls     121

Overview of the Validation Controls     121

Validation Controls and JavaScript     126

Using Page.IsValid     126

Setting the Display Property     127

Highlighting Validation Errors     128

Using Validation Groups     133

Disabling Validation     138

Using the RequiredFieldValidator Control     139

Using the RangeValidator Control     143

Using the CompareValidator Control     146

Using the RegularExpressionValidator Control     151

Using the CustomValidator Control     154

Using the ValidationSummary Control     162

Creating Custom Validation Controls     167

Creating a LengthValidator Control     168

Creating an AjaxValidator Control     170

Summary     177

4   Using the Rich Controls     179

Accepting File Uploads     180

Saving Files to the File System     181

Saving Files to a Database     185

Uploading Large Files     189

Displaying a Calendar     195

Creating a Pop-Up Date Picker     199

Rendering a Calendar from a Database Table     202

Displaying Advertisements      207

Storing Advertisements in an XML File     208

Storing Advertisements in a Database Table     212

Tracking Impressions and Transfers     213

Displaying Different Page Views     220

Displaying a Tabbed Page View      220

Displaying a Multipart Form     223

Displaying a Wizard     226

Displaying Silverlight Content     231

Summary     234

Part II   Designing ASP.NET Websites

5   Designing Websites with Master Pages     237

Creating Master Pages     238

Creating Default Content     242

Nesting Master Pages     245

Using Images and Hyperlinks in Master Pages     251

Registering Master Pages in Web Configuration     254

Modifying Master Page Content     255

Using the Title Attribute     255

Using the Page Header Property     256

Exposing Master Page Properties     258

Using FindControl with Master Pages     261

Loading Master Pages Dynamically     263

Loading Master Pages Dynamically for Multiple Content Pages     266

Summary     268

6   Designing Websites with Themes     269

Creating Themes     270

Adding Skins to Themes     270

Creating Named Skins     273

Themes Versus StyleSheetThemes     275

Disabling Themes     277

Registering Themes in the Web Configuration File     280

Adding Cascading Style Sheets to Themes     281

Adding Multiple Cascading Style Sheets to a Theme     285

Changing Page Layouts with Cascading Style Sheets     285

Creating Global Themes     290

Applying Themes Dynamically     291

Applying Skins Dynamically     293

Summary     298

7   Creating Custom Controls with User Controls     299

Creating User Controls     300

Registering User Controls in the Web Configuration File     303

Exposing Properties from a User Control     304

Exposing Events from a User Control     307

Creating an AddressForm Control     311

AJAX and User Controls     317

Dynamically Loading User Controls     320

Using the Reference Directive     322

Creating a Multipage Wizard     327

Summary     336

Part III   Performing Data Access

8   Overview of Data Access     337

Using DataBound Controls     337

Working with List Controls     338

Working with Tabular DataBound Controls     341

Working with Hierarchical DataBound Controls     345

Working with Other Controls     348

Using DataSource Controls     351

Using ASP.NET Parameters with DataSource Controls     353

Using Programmatic DataBinding     356

Understanding Templates and DataBinding Expressions     358

Using Templates     359

Using DataBinding Expressions     362

Using Two-Way DataBinding Expressions     366

Overview of SQL Server 2008 Express     369

Features of SQL Server Express     369

SQL Server 2008 Express Management Tools     370

Server Databases Versus Local Databases     371

Sample Database-Driven Web Application     375

Summary     378

9   Using the SqlDataSource Control     379

Creating Database Connections     380

Connecting to Microsoft SQL Server     380

Connecting to Other Databases     384

Storing Connection Strings in the Web Configuration File     386

Encrypting Connection Strings     388

Executing Database Commands     389

Executing Inline SQL Statements    389

Executing Stored Procedures     392

Filtering Database Rows     395

Changing the Data Source Mode     397

Handling SQL Command Execution Errors     398

Canceling Command Execution     403

Using ASP.NET Parameters with the SqlDataSource Control    406

Using the ASP.NET Parameter Object    406

Using the ASP.NET ControlParameter Object     410

Using the ASP.NET CookieParameter Object     415

Using the ASP.NET FormParameter Object     417

Using the ASP.NET ProfileParameter Object     420

Using the QueryStringParameter Object     422

Using the SessionParameter Object     424

Programmatically Executing SqlDataSource Commands     426

Adding ADO.NET Parameters     426

Executing Insert, Update, and Delete Commands     428

Executing Select Commands     430

Caching Database Data with the SqlDataSource Control     435

Summary     438

10   Using List Controls     439

Overview of the List Controls     439

Declaring List Items     439

Binding to a Data Source     442

Determining the Selected List Item     446

Appending Data Items     450

Enabling Automatic PostBacks     452

Using the Items Collection     454

Working with the DropDownList Control     458

Working with the RadioButtonList Control     461

Working with the ListBox Control     463

Working with the CheckBoxList Control     467

Working with the BulletedList Control     470

Creating a Custom List Control     475

Summary     484

11   Using the GridView Control     485

GridView Control Fundamentals     486

Displaying Data     486

Selecting Data     489

Using Data Keys     492

Sorting Data     495

Paging Through Data     501

Editing Data     510

Displaying Empty Data     514

Formatting the GridView Control     519

Using ViewState with the GridView Control     521

Using Fields with the GridView Control     522

Using BoundFields     523

Using CheckBoxFields     526

Using CommandFields     527

Using Button Fields     530

Using HyperLink Fields     534

Using ImageFields     539

Using TemplateFields     543

Working with GridView Control Events     546

Highlighting GridView Rows     547

Displaying Column Summaries     550

Displaying Nested Master/Details Forms     552

Extending the GridView Control     555

Creating a LongTextField     556

Creating a DeleteButtonField     560

Creating a ValidatedField     563

Summary     566

12   Using the DetailsView and FormView Controls     567

Using the DetailsView Control     567

Displaying Data with the DetailsView Control     567

Using Fields with the DetailsView Control     571

Displaying Empty Data with the DetailsView Control     573

Paging through Data with the DetailsView Control     576

Updating Data with the DetailsView Control     584

Inserting Data with the DetailsView Control     593

Deleting Data with the DetailsView Control     597

Working with DetailsView Control Events     598

Formatting the DetailsView Control     601

Using the FormView Control     604

Displaying Data with the FormView Control     605

Paging Through Data with the FormView Control     607

Editing Data with the FormView Control     612

Inserting Data with the FormView Control     616

Deleting Data with the FormView Control     619

Summary     622

13   Using the Repeater and DataList Controls     623

Using the Repeater Control     623

Displaying Data with the Repeater Control     624

Using Templates with the Repeater Control     627

Handling Repeater Control Events     633

Using the DataList Control     640

Displaying Data with the DataList Control     640

Displaying Data in Multiple Columns     644

Using Templates with the DataList Control     645

Selecting Data with the DataList Control     648

Editing Data with the DataList Control     651

Formatting the DataList Control     657

Summary     660

14   Using the ListView and DataPager Controls     661

Using the ListView Control     661

Using the LayoutTemplate and ItemTemplate     662

Using the GroupTemplate     666

Selecting a Row     669

Sorting Database Data     672

Editing Database Data     675

Using the DataPager Control     681

Creating a Custom User Interface for Paging     684

Data Source Paging with the DataPager Control     686

Summary     688

15   Using the Chart Control     689

Chart Control Fundamentals     690

Displaying Data with the Chart Control     690

Sorting and Filtering Data     694

Using Statistical Formulas     698

Customizing a Chart’s Appearance     704

Customizing the Background and Plotting Area     704

Three-Dimensional Charts     708

Drill-Down Reports     709

Summary     710

16   Using the QueryExtender Control     711

Introduction to the QueryExtender Control     711

Querying Data with Declarative Syntax     712

Querying with the ControlFilterExpression     712

Querying with the CustomExpression     712

Querying with the DynamicFilterExpression     713

Querying with the MethodExpression     713

Sorting with the OrderByExpression     714

Querying with the PropertyExpression     715

Querying with the RangeExpression     715

Querying with the SearchExpression     716

Building a Sample Page with the QueryExtender Control     717

Summary     720

Part IV   Building Components

17   Building Components     721

Building Basic Components     722

Components and Dynamic Compilation     724

Mixing Different Language Components in the App_Code Folder     725

Declaring Methods     726

Declaring Fields and Properties     728

Declaring Constructors     733

Overloading Methods and Constructors     734

Declaring Namespaces     736

Creating Partial Classes     738

Inheritance and Abstract Classes     739

Declaring Interfaces     742

Using Access Modifiers     743

Intellisense and Components     744

Using ASP.NET Intrinsics in a Component     746

Building Component Libraries     749

Compiling Component Libraries     750

Adding a Reference to a Class Library     753

Architectural Considerations     757

Building Multitier Applications     757

Creating the User Interface Layer     758

Creating the Business Logic Layer     761

Creating the Data Access Layer     765

Summary     769

18   Using the ObjectDataSource Control     771

Representing Objects with the ObjectDataSource Control     772

Binding to a Component     772

Binding to a DataReader     774

Binding to a DataSet     776

Binding to a LINQ to SQL Query     778

Binding to a Web Service     779

Using Parameters with the ObjectDataSource Control     783

Using Different Parameter Types     787

Passing Objects as Parameters     790

Paging, Sorting, and Filtering Data with the ObjectDataSource Control     795

User Interface Paging     795

Data Source Paging     798

User Interface Sorting     805

Data Source Sorting     808

Filtering Data     813

Handling ObjectDataSource Control Events     817

Adding and Modifying Parameters     818

Handling Method Errors     822

Handling the ObjectCreating Event     826

Concurrency and the ObjectDataSource Control     828

Extending the ObjectDataSource Control     832

Creating a Custom ObjectDataSource Control     832

Creating Custom Parameter Objects     835

Summary     841

19   Building Data Access Components with ADO.NET     843

Connected Data Access     844

Using the Connection Object     848

Using the Command Object     859

Using the DataReader Object     881

Disconnected Data Access     888

Using the DataAdapter Object     889

Using the DataTable Object     896

Using the DataView Object     906

Using the DataSet Object     908

Executing Asynchronous Database Commands     911

Using Asynchronous ADO.NET Methods     912

Using Asynchronous ASP.NET Pages     914

Building Database Objects with the .NET Framework     918

Enabling CLR Integration     918

Creating User-Defined Types with .NET Framework     919

Building a Data Access Layer with a User-Defined Type     924

Creating Stored Procedures with .NET Framework     928

Creating the Stored Procedure Assembly     928

Summary     934

20   Data Access with LINQ to SQL     935

New C# and VB.NET Language Features     936

Understanding Automatic Properties     936

Understanding Initializers     937

Understanding Type Inference     939

Understanding Anonymous Types     940

Understanding Generics     941

Understanding Lambda Expressions     944

Understanding Extension Methods     948

Understanding LINQ     949

Creating LINQ to SQL Entities     951

Building Entities by Hand     952

Building Entities with the LINQ to SQL Designer     956

Building Entity Associations     959

Using the LinqDataSource Control     960

Performing Standard Database Commands with LINQ to SQL     964

LINQ to Objects Versus LINQ to SQL     964

Selecting with LINQ to SQL     965

Inserting with LINQ to SQL     973

Updating with LINQ to SQL     976

Deleting with LINQ to SQL     981

Dynamic Queries     983

Debugging LINQ to SQL     987

Creating a Custom LINQ Entity Base Class     991

Using the Entity Base Class     991

Performing Standard Data-Access Operations with the EntityBase Class     992

Performing Validation with the EntityBase Class     994

Summary     1000

21   Data Access with WCF Data Services     1001

Overview of WCF Data Services      1001

Using Data Services with a Service Reference     1002

Using Data Services with a Data Context      1007

Summary     1009

Part V   Site Navigation

22   Using the Navigation Controls     1011

Understanding Site Maps     1011

Using the SiteMapPath Control     1013

Formatting the SiteMapPath Control     1016

Using the Menu Control     1020

Declaratively Adding Menu Items     1021

Using the Menu Control with the MultiView Control     1024

Binding to a Site Map     1027

Binding to an XML File     1031

Binding to Database Data     1035

Formatting the Menu Control     1040

Using Templates with the Menu Control     1046

Using the TreeView Control     1049

Declaratively Adding Tree Nodes     1049

Displaying Check Boxes with the TreeView Control     1054

Binding to a Site Map     1057

Binding to an XML File     1058

Binding to Database Data     1061

Using Populate On Demand and AJAX     1064

Formatting the TreeView Control     1070

Building a SQL Hierarchical Data Source Control     1077

Summary     1081

23   Using Site Maps     1083

Using the SiteMapDataSource Control     1084

Setting SiteMapDataSource Properties     1086

Using the SiteMap Class     1090

Using the SiteMapNode Class     1093

Advanced Site Map Configuration     1095

Using Security Trimming     1096

Merging Multiple Site Maps     1101

Creating Custom Site Map Attributes     1103

Creating Custom Site Map Providers     1105

Creating the AutoSiteMapProvider     1106

Creating the SqlSiteMapProvider     1111

Generating a Google SiteMap File     1116

Summary     1120

24   Advanced Navigation     1123

Remapping URLs     1124

Creating a Custom UrlRemapper Module     1127

Using the VirtualPathProvider Class     1132

Limitations of the VirtualPathProvider Class     1133

Understanding the VirtualPathProvider Class     1133

Registering a VirtualPathProvider Class     1135

Summary     1136

25   Using the ASP.NET URL Routing Engine     1137

Introduction to URL Routing     1137

Basic URL Routing Scenarios     1139

Mapping Basic URLs     1139

Mapping URLs with Parameters     1140

Mapping URLs with Multiple Segments     1141

Linking to Other Pages with Routes     1142

Advanced URL Routing     1143

Using Routes with Default Parameters     1143

Using Constrained Routes     1144

Security Concerns with Routes     1146

Summary     1146

Part VI   Security

26   Using the Login Controls     1147

Overview of the Login Controls     1148

Using the Login Control     1152

Automatically Redirecting a User to the Referring Page     1155

Automatically Hiding the Login Control from Authenticated Users     1155

Using a Template with the Login Control     1157

Performing Custom Authentication with the Login Control     1160

Using the CreateUserWizard Control     1162

Configuring Create User Form Fields     1163

Sending a Create User Email Message     1166

Automatically Redirecting a User to the Referring Page     1169

Automatically Generating a Password     1171

Using Templates with the CreateUserWizard Control     1177

Adding Steps to the CreateUserWizard Control     1181

Using the LoginStatus Control     1183

Using the LoginName Control     1185

Using the ChangePassword Control     1186

Sending a Change Password Email     1188

Using Templates with the ChangePassword Control     1190

Using the PasswordRecovery Control     1193

Sending the Original Password     1195

Requiring a Security Question and Answer     1196

Using Templates with the PasswordRecovery Control     1197

Using the LoginView Control     1199

Using Roles with the LoginView Control     1201

Summary     1204

27   Using ASP.NET Membership     1205

Configuring Authentication     1206

Configuring Forms Authentication     1207

Using Cookieless Forms Authentication     1209

Using Sliding Expiration with Forms Authentication     1210

Using Forms Authentication Across Applications     1210

Using Forms Authentication Across Domains     1214

Using the FormsAuthentication Class    1216

Using the User Class     1220

Configuring Authorization     1221

Authorizing by Role     1223

Authorizing Files by Location     1224

Using Authorization with Images and Other File Types     1225

Using ASP.NET Membership     1226

Using the Membership Application Programming Interface     1227

Encrypting and Hashing User Passwords     1232

Modifying User Password Requirements     1234

Locking Out Bad Users     1235

Configuring the SQLMembershipProvider     1237

Configuring the ActiveDirectoryMembershipProvider     1239

Creating a Custom Membership Provider     1244

Using the Role Manager     1246

Configuring the SqlRoleProvider     1247

Configuring the WindowsTokenRoleProvider     1252

Configuring the AuthorizationStoreRoleProvider     1254

Caching Roles in a Browser Cookie     1256

Using the Roles Application Programming Interface     1258

Summary     1260

Part VII   Building ASP.NET Applications

28   Maintaining Application State     1263

Using Browser Cookies     1264

Cookie Security Restrictions     1265

Creating Cookies     1266

Reading Cookies     1269

Setting Cookie Properties     1272

Deleting Cookies     1273

Working with Multivalued Cookies     1275

Using Session State     1279

Storing Database Data in Session State     1281

Using the Session Object     1284

Handling Session Events     1285

Controlling When a Session Times Out     1287

Using Cookieless Session State     1288

Configuring a Session State Store     1290

Configuring SQL Server Session State     1294

Using Profiles     1297

Creating Profile Groups     1301

Supporting Anonymous Users     1303

Migrating Anonymous Profiles     1307

Inheriting a Profile from a Custom Class     1308

Creating Complex Profile Properties     1310

Saving Profiles Automatically     1317

Accessing Profiles from Components     1321

Using the Profile Manager     1323

Configuring the Profile Provider     1326

Creating a Custom Profile Provider     1327

Summary     1332

29   Caching Application Pages and Data     1335

Overview of Caching     1335

Using Page Output Caching     1337

Varying the Output Cache by Parameter    1338

Varying the Output Cache by Control     1342

Varying the Output Cache by Header     1345

Varying the Output Cache by Browser     1346

Varying the Output Cache by a Custom Function     1347

Specifying the Cache Location     1349

Creating a Page Output Cache File Dependency     1351

Expiring the Page Output Cache Programmatically     1353

Manipulating the Page Output Cache Programmatically      1358

Creating Page Output Cache Profiles     1360

Using Partial Page Caching     1361

Using Post-Cache Substitution     1362

Caching with a User Control     1366

Sharing a User Control Output Cache     1370

Manipulating a User Control Cache Programmatically     1370

Creating a User Control Cache File Dependency     1372

Caching Dynamically Loaded User Controls     1373

Using DataSource Caching     1375

Using an Absolute Cache Expiration Policy     1376

Using a Sliding Cache Expiration Policy     1378

Caching with the ObjectDataSource Control     1380

Caching with the XmlDataSource Control     1382

Creating a DataSource Control Key Dependency     1383

Using Data Caching     1387

Using the Cache Application Programming Interface     1387

Adding Items to the Cache     1390

Adding Items with an Absolute Expiration Policy     1390

Adding Items with a Sliding Expiration Policy     1393

Adding Items with Dependencies     1394

Specifying Cache Item Priorities     1396

Configuring the Cache     1397

Using SQL Cache Dependencies     1399

Using Polling SQL Cache Dependencies     1399

Configuring Polling SQL Cache Dependencies     1400

Using Polling SQL Cache Dependencies with Page Output Caching     1403

Using Polling SQL Cache Dependencies with DataSource Caching      1405

Using Polling SQL Cache Dependencies with Data Caching.........1406

Using Push SQL Cache Dependencies     1408

Configuring Push SQL Cache Dependencies     1409

Using Push SQL Cache Dependencies with Page Output Caching     1411

Using Push SQL Cache Dependencies with DataSource Caching      1412

Using Push SQL Cache Dependencies with Data Caching     1415

Summary     1416

30   Localizing Applications for Multiple Languages     1419

Setting the Current Culture     1420

Setting a Culture Manually     1421

Automatically Detecting a Culture     1428

Setting the Culture in the Web Configuration File     1432

Culture and ASP.NET Controls     1433

Using the CultureInfo Class     1434

Using the CultureInfo Class to Format String Values    1435

Comparing and Sorting String Values     1437

Creating Local Resources     1438

Explicit Localization Expressions     1438

Implicit Localization Expressions     1441

Using Local Resources with Page Properties     1443

Retrieving Local Resources Programmatically     1444

Creating Global Resources     1446

Retrieving Global Resources Programmatically     1448

Using Strongly Typed Localization Expressions     1449

Using the Localize Control     1450

Summary     1452

31   Working with the HTTP Runtime     1453

Creating a Custom BuildProvider     1454

Creating a Simple BuildProvider     1454

Creating a Data Access Component BuildProvider     1458

Creating a Custom ExpressionBuilder     1464

Creating a Lookup ExpressionBuilder     1465

Creating HTTP Handlers     1470

Creating a Generic Handler     1470

Implementing the IHttpHandler Interface     1473

Creating an Asynchronous HTTP Handler     1478

Working with HTTP Applications and HTTP Modules     1482

Creating a Global.asax File     1483

Creating Custom HTTP Modules     1487

Summary     1489

32   Building Dynamic Data Applications    1491

Introducing ASP.NET Dynamic Data     1491

Building a Dynamic Data Application     1492

Working with Dynamic Data Templates     1496

Making Shared Template Changes    1497

Creating Type and Entity-Specific Templates     1497

Summary     1500

33   Building ASP.NET MVC Applications     1501

Introducing the ASP.NET MVC Framework     1501

Models     1502

Views     1502

Controllers     1502

Creating Your First ASP.NET MVC Application     1502

Building an MVC Page     1505

Accepting Form Input     1507

Summary     1509

34   Configuring Applications     1511

Overview of Website Configuration     1511

Using the Web Site Administration Tool     1513

Using the ASP.NET Microsoft Management Console Snap-In     1514

ASP.NET Configuration Sections     1515

Applying Configuration Settings to a Particular Path     1517

Locking Configuration Settings     1518

Adding Custom Application Settings     1520

Placing Configuration Settings in an External File    1522

Using the Configuration API     1523

Reading Configuration Sections from the Current Application     1524

Opening a Configuration File     1529

Opening a Configuration File on a Remote Server     1533

Using the Configuration Class     1536

Modifying Configuration Sections     1539

Provisioning a New Website     1543

Creating Custom Configuration Sections     1546

Creating a Configuration Element Collection     1551

Creating Encrypted Configuration Sections     1556

Encrypting Sections with the aspnet_regiis Tool    1557

Encrypting Sections Programmatically     1558

Deploying Encrypted Web Configuration Files     1561

Summary     1564

35   Deploying ASP.NET Web Applications     1565

Packaging Web Applications     1565

Using Web.config Transformations     1569

Deploying Databases     1571

One-Click Publishing Web Applications     1572

Summary     1573

Part VIII   Custom Control Building

36   Building Custom Controls     1575

Overview of Custom Control Building     1575

Building Fully Rendered Controls     1576

Building Composite Controls     1587

Building Hybrid Controls     1590

View State and Control State     1596

Supporting View State     1596

Supporting Control State     1599

Processing Postback Data and Events     1602

Handling Postback Data     1602

Handling Postback Events     1606

Working with Control Property Collections     1618

Using the ParseChildren Attribute     1618

Using the AddParsedSubObject() Method     1626

Using a ControlBuilder     1626

Creating a Better Designer Experience     1631

Applying Design-Time Attributes to a Control     1631

Creating Control Designers     1636

Creating a Container ControlDesigner     1636

Adding Smart Tasks     1640

Summary     1645

37   Building Templated Databound Controls     1647

Creating Templated Controls     1647

Implementing the ITemplate Interface     1648

Creating a Default Template     1652

Supporting Simplified Databinding     1656

Supporting Two-Way Databinding     1660

Creating Templated Databound Controls     1666

Creating a DivView Control     1667

Summary     1672


38   Using Server-Side ASP.NET AJAX     1673

The Ajax Vision     1674

Server-Side Ajax Versus Client-Side Ajax     1675

Debugging Ajax Applications     1675

Using the UpdatePanel Control     1677

Specifying UpdatePanel Triggers     1686

Nesting UpdatePanel Controls     1688

Updating UpdatePanels Programmatically     1692

UpdatePanels and JavaScript     1694

UpdatePanel Server-Side Page Execution Life Cycle     1697

UpdatePanel Client-Side Page Execution Life Cycle     1700

Canceling the Current Asynchronous Postback     1707

Aborting the Previous Asynchronous Postback     1710

Passing Additional Information During an Asynchronous Postback     1712

Handling UpdatePanel Errors Gracefully     1714

UpdatePanel Performance     1720

Using the Timer Control     1724

Using the UpdateProgress Control     1728

Summary     1731

39   Using the ASP.NET AJAX Control Toolkit     1733

Using the ASP.NET AJAX Control Toolkit     1734

Overview of the Toolkit Controls     1737

Using the AutoComplete Control     1739

Using the AutoCompleteExtender with a Page Method     1740

Using the AutoCompleteExtender with a Web Service Method     1743

Using Text and Value Pairs with the AutoCompleteExtender     1746

Using the DragPanel Control     1750

Using the FilteredTextBox Control     1754

Using the MaskedEdit Control     1756

Using the Animation Control     1759

Using the UpdatePanelAnimation Control     1764

Summary     1768

40   Client-Side Ajax with jQuery     1769

What Is jQuery?     1769

Using the jQuery Library     1770

Creating a jQuery File     1771

The $ Method and $(document).ready()     1773

jQuery Selectors     1774

Calling Web Services from the Client     1776

Calling an External Web Service     1776

Calling a Static Page Method     1780

Summary     1781

Index     1783


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020