ASP.NET 2.0 Cookbook, 2/e

Michael A Kittel, Geoffrey T. LeBlond

  • 出版商: O'Reilly
  • 出版日期: 2005-12-01
  • 售價: $1,790
  • 貴賓價: 9.5$1,701
  • 語言: 英文
  • 頁數: 1024
  • 裝訂: Paperback
  • ISBN: 0596100647
  • ISBN-13: 9780596100643
  • 相關分類: .NETASP.NET

已過版

買這商品的人也買了...

相關主題

商品描述

Description

Completely revised for ASP.NET 2.0, this new edition of the best-selling ASP.NET Cookbook has everything you need to go from beginning to advanced Windows-based web site development using Microsoft's popular Visual Studio 2005 and ASP.NET 2.0 developer tools. Written for the impatient professional, ASP.NET 2.0 Cookbook contains more than 125 recipes for solving common and not-so-common problems you are likely to encounter when building ASP.NET-based web applications.


The recipes in this book, which run the gamut from simple coding techniques to more comprehensive development strategies, are presented in the popular Problem-Solution-Discussion format of the O'Reilly Cookbook series. As with the first edition, every solution is coded in both C# and Visual Basic 2005.


Among the additions and revisions to this new edition are:

  • Three new chapters, including 25 new recipes for Master and Content pages, Personalization using Profiles and Themes, Custom Web Parts, and more
  • New code for every solution, rewritten to take advantage of features and techniques new to ASP.NET 2.0 and available for download


The ASP.NET 2.0 Cookbook continues to provide the most comprehensive coverage you'll find anywhere of:

  • Tabular controls, including the new GridView control
  • Data validation, including the new ASP.NET 2.0 validation controls, as well as techniques for performing your own validation programmatically
  • User and custom controls
  • Error handling, performance tuning, and caching

Table of Contents

Preface

1. Master Pages

      1.1 Generating a Quick Master/Content Page Arrangement  

      1.2 Extending a Master Page's Content to Include Content for Other Application Pages  

      1.3 Changing Which Master Page Is Used Without Modifying All Affected Application Pages  

      1.4 Setting the Master Page at Runtime  

2. Tabular Data

      2.1 Selecting the Right Tabular Control  

      2.2 Generating a Quick-and-Dirty Tabular Display  

      2.3 Enhancing the Output of a Tabular Display  

      2.4 Displaying Data from an XML File  

      2.5 Displaying an Array as a Group of Checkboxes  

      2.6 Displaying Data from a Hashtable  

      2.7 Adding Next/Previous Navigation to a DataGrid  

      2.8 Adding First/Last Navigation to a DataGrid  

      2.9 Adding Direct Page Navigation to a DataGrid  

      2.10 Sorting Data in Ascending/Descending Order Within a DataGrid  

      2.11 Combining Sorting and Paging in a DataGrid  

      2.12 Paging Through a Record-Heavy DataGrid  

      2.13 Editing Data Within a DataGrid  

      2.14 Navigating and Sorting Within a GridView  

      2.15 Updating a GridView Without Refreshing the Whole Page  

      2.16 Editing Data in a GridView  

      2.17 Inserting a Row Within a GridView  

      2.18 Formatting Columnar Data in a GridView  

      2.19 Allowing Selection Anywhere Within a GridView  

      2.20 Adding a Delete Confirmation Pop-Up  

      2.21 Displaying a Pop-Up Details Window  

      2.22 Adding a Totals Row to a GridView  

3. Validation

      3.1 Requiring That Data Be Entered in a Field  

      3.2 Requiring Data to Be in a Range  

      3.3 Requiring That Two Data Input Fields Match  

      3.4 Requiring Data to Match a Predefined Pattern  

      3.5 Requiring That a Drop-Down List Selection Be Made  

      3.6 Requiring Data to Match a Database Entry  

      3.7 Using Validation Groups to Support Login and New User Registration Within a Single Form  

      3.8 Performing Validation Programmatically to Execute Your Own Application-Specific Logic  

4. Forms

      4.1 Setting the Default Button to Submit a Form  

      4.2 Submitting a Form to a Different Page  

      4.3 Simulating Multipage Forms  

      4.4 Setting the Initial Focus to a Specific Control  

      4.5 Setting the Focus to a Control with a Validation Error  

5. User Controls

      5.1 Sharing a Page Header on Multiple Pages  

      5.2 Creating a Customizable Navigation Bar  

      5.3 Reusing Code-Behind Classes  

      5.4 Communicating Between User Controls  

      5.5 Adding User Controls Dynamically  

6. Custom Controls

      6.1 Combining HTML Controls in a Single Custom Control  

      6.2 Creating a Custom Control with Attributes  

      6.3 Creating a Custom Control with State  

      6.4 Using the Control State with Custom Controls  

      6.5 Customizing an ASP.NET TextBox Server Control  

7. Maintaining State

      7.1 Maintaining Information Needed by All Users of an Application  

      7.2 Maintaining Information About a User Throughout a Session  

      7.3 Preserving Information Between Postbacks  

      7.4 Preserving Information Across Multiple Requests for a Page  

8. Error Handling

      8.1 Handling Errors at the Method Level  

      8.2 Handling Errors at the Page Level  

      8.3 Handling Errors at the Application Level  

      8.4 Displaying User-Friendly Error Messages  

9. Security

      9.1 Restricting Access to All Application Pages  

      9.2 Restricting Access to Selected Application Pages  

      9.3 Restricting Access to Application Pages by Role  

      9.4 Using Windows Authentication  

      9.5 Using Membership and Roles  

10. Profiles and Themes

      10.1 Using Profiles  

      10.2 Inheriting a Profile  

      10.3 Using and Migrating Anonymous Profiles  

      10.4 Managing User Profiles  

      10.5 Using Themes  

      10.6 User-Personalized Themes  

11. Web Parts

      11.1 Using Server Controls and User Controls as Web Parts  

      11.2 Creating a Reusable Web Parts Catalog  

      11.3 Creating a Custom Web Part  

      11.4 Communicating Between Web Parts  

      11.5 Persisting Personalized Web Part Properties  

12. Configuration

      12.1 Overriding Default HTTP Runtime Parameters in web.config  

      12.2 Adding Custom Application Settings in web.config  

      12.3 Displaying Custom Error Messages  

      12.4 Maintaining Session State Across Multiple Web Servers  

      12.5 Accessing Other web.config Configuration Elements  

      12.6 Adding Your Own Configuration Elements to web.config  

      12.7 Encrypting web.config Sections  

13. Tracing and Debugging

      13.1 Uncovering Page-Level Problems  

      13.2 Uncovering Application-Wide Problems  

      13.3 Pinpointing the Cause of an Exception  

      13.4 Uncovering Problems Within Web Application Components  

      13.5 Uncovering Problems Within Dual-Use Components  

      13.6 Writing Trace Data to the Event Log with Controllable Levels  

      13.7 Sending Trace Data via Email with Controllable Levels  

      13.8 Using a Breakpoint to Stop Execution of an Application When a Condition Is Met  

14. Web Services

      14.1 Creating a Web Service  

      14.2 Consuming a Web Service  

      14.3 Creating a Web Service That Returns a Custom Object  

      14.4 Setting the URL of a Web Service at Runtime  

15. Dynamic Images

      15.1 Drawing Button Images on the Fly  

      15.2 Creating Bar Charts on the Fly  

      15.3 Displaying Images Stored in a Database  

      15.4 Displaying Thumbnail Images  

16. Caching

      16.1 Caching Pages  

      16.2 Caching Pages Based on Query String Parameter Values  

      16.3 Caching Pages Based on Browser Type and Version  

      16.4 Caching Pages Based on Developer-Defined Custom Strings  

      16.5 Caching Pages Based on Database Dependencies  

      16.6 Caching User Controls  

      16.7 Caching Application Data  

      16.8 Caching Application Data Based on Database Dependencies  

      16.9 Caching Data Sources  

17. Internationalization

      17.1 Localizing Request/Response Encoding  

      17.2 Providing Multiple Language Support  

      17.3 Using Global Resources and Overriding Currency Formatting  

18. File Operations

      18.1 Downloading a File from the Web Server  

      18.2 Uploading a File to the Web Server  

      18.3 Processing an Uploaded File Without Storing It on the Filesystem  

      18.4 Storing the Contents of an Uploaded File in a Database  

19. Performance

      19.1 Reducing Page Size by Selectively Disabling the ViewState  

      19.2 Speeding Up String Concatenation with a StringBuilder  

      19.3 Speeding Up Read-Only Data Access  

      19.4 Speeding Up Data Access to a SQL Server Database Using the SQL Provider  

20. HTTP Handlers

      20.1 Creating a Reusable Image Handler  

      20.2 Creating a File Download Handler  

21. Assorted Tips

      21.1 Accessing HTTP-Specific Information from Within a Class  

      21.2 Executing External Applications  

      21.3 Transforming XML to HTML  

      21.4 Determining the User's Browser Type  

      21.5 Dynamically Creating Browser-Specific Stylesheets  

      21.6 Saving and Reusing HTML Output  

      21.7 Sending Mail  

      21.8 Dynamic Menus  

      21.9 Adding Breadcrumbs  

Index

Preface

1. Master Pages

      1.1 Generating a Quick Master/Content Page Arrangement  

      1.2 Extending a Master Page's Content to Include Content for Other Application Pages  

      1.3 Changing Which Master Page Is Used Without Modifying All Affected Application Pages  

      1.4 Setting the Master Page at Runtime  

2. Tabular Data

      2.1 Selecting the Right Tabular Control  

      2.2 Generating a Quick-and-Dirty Tabular Display  

      2.3 Enhancing the Output of a Tabular Display  

      2.4 Displaying Data from an XML File  

      2.5 Displaying an Array as a Group of Checkboxes  

      2.6 Displaying Data from a Hashtable  

      2.7 Adding Next/Previous Navigation to a DataGrid  

      2.8 Adding First/Last Navigation to a DataGrid  

      2.9 Adding Direct Page Navigation to a DataGrid  

      2.10 Sorting Data in Ascending/Descending Order Within a DataGrid  

      2.11 Combining Sorting and Paging in a DataGrid  

      2.12 Paging Through a Record-Heavy DataGrid  

      2.13 Editing Data Within a DataGrid  

      2.14 Navigating and Sorting Within a GridView  

      2.15 Updating a GridView Without Refreshing the Whole Page  

      2.16 Editing Data in a GridView  

      2.17 Inserting a Row Within a GridView  

      2.18 Formatting Columnar Data in a GridView  

      2.19 Allowing Selection Anywhere Within a GridView  

      2.20 Adding a Delete Confirmation Pop-Up  

      2.21 Displaying a Pop-Up Details Window  

      2.22 Adding a Totals Row to a GridView  

3. Validation

      3.1 Requiring That Data Be Entered in a Field  

      3.2 Requiring Data to Be in a Range  

      3.3 Requiring That Two Data Input Fields Match  

      3.4 Requiring Data to Match a Predefined Pattern  

      3.5 Requiring That a Drop-Down List Selection Be Made  

      3.6 Requiring Data to Match a Database Entry  

      3.7 Using Validation Groups to Support Login and New User Registration Within a Single Form  

      3.8 Performing Validation Programmatically to Execute Your Own Application-Specific Logic  

4. Forms

      4.1 Setting the Default Button to Submit a Form  

      4.2 Submitting a Form to a Different Page  

      4.3 Simulating Multipage Forms  

      4.4 Setting the Initial Focus to a Specific Control  

      4.5 Setting the Focus to a Control with a Validation Error  

5. User Controls

      5.1 Sharing a Page Header on Multiple Pages  

      5.2 Creating a Customizable Navigation Bar  

      5.3 Reusing Code-Behind Classes  

      5.4 Communicating Between User Controls  

      5.5 Adding User Controls Dynamically  

6. Custom Controls

      6.1 Combining HTML Controls in a Single Custom Control  

      6.2 Creating a Custom Control with Attributes  

      6.3 Creating a Custom Control with State  

      6.4 Using the Control State with Custom Controls  

      6.5 Customizing an ASP.NET TextBox Server Control  

7. Maintaining State

      7.1 Maintaining Information Needed by All Users of an Application  

      7.2 Maintaining Information About a User Throughout a Session  

      7.3 Preserving Information Between Postbacks  

      7.4 Preserving Information Across Multiple Requests for a Page  

8. Error Handling

      8.1 Handling Errors at the Method Level  

      8.2 Handling Errors at the Page Level  

      8.3 Handling Errors at the Application Level  

      8.4 Displaying User-Friendly Error Messages  

9. Security

      9.1 Restricting Access to All Application Pages  

      9.2 Restricting Access to Selected Application Pages  

      9.3 Restricting Access to Application Pages by Role  

      9.4 Using Windows Authentication  

      9.5 Using Membership and Roles  

10. Profiles and Themes

      10.1 Using Profiles  

      10.2 Inheriting a Profile  

      10.3 Using and Migrating Anonymous Profiles  

      10.4 Managing User Profiles  

      10.5 Using Themes  

      10.6 User-Personalized Themes  

11. Web Parts

      11.1 Using Server Controls and User Controls as Web Parts  

      11.2 Creating a Reusable Web Parts Catalog  

      11.3 Creating a Custom Web Part  

      11.4 Communicating Between Web Parts  

      11.5 Persisting Personalized Web Part Properties  

12. Configuration

      12.1 Overriding Default HTTP Runtime Parameters in web.config  

      12.2 Adding Custom Application Settings in web.config  

      12.3 Displaying Custom Error Messages  

      12.4 Maintaining Session State Across Multiple Web Servers  

      12.5 Accessing Other web.config Configuration Elements  

      12.6 Adding Your Own Configuration Elements to web.config  

      12.7 Encrypting web.config Sections  

13. Tracing and Debugging

      13.1 Uncovering Page-Level Problems  

      13.2 Uncovering Application-Wide Problems  

      13.3 Pinpointing the Cause of an Exception  

      13.4 Uncovering Problems Within Web Application Components  

      13.5 Uncovering Problems Within Dual-Use Components  

      13.6 Writing Trace Data to the Event Log with Controllable Levels  

      13.7 Sending Trace Data via Email with Controllable Levels  

      13.8 Using a Breakpoint to Stop Execution of an Application When a Condition Is Met  

14. Web Services

      14.1 Creating a Web Service  

      14.2 Consuming a Web Service  

      14.3 Creating a Web Service That Returns a Custom Object  

      14.4 Setting the URL of a Web Service at Runtime  

15. Dynamic Images

      15.1 Drawing Button Images on the Fly  

      15.2 Creating Bar Charts on the Fly  

      15.3 Displaying Images Stored in a Database  

      15.4 Displaying Thumbnail Images  

16. Caching

      16.1 Caching Pages  

      16.2 Caching Pages Based on Query String Parameter Values  

      16.3 Caching Pages Based on Browser Type and Version  

      16.4 Caching Pages Based on Developer-Defined Custom Strings  

      16.5 Caching Pages Based on Database Dependencies  

      16.6 Caching User Controls  

      16.7 Caching Application Data  

      16.8 Caching Application Data Based on Database Dependencies  

      16.9 Caching Data Sources  

17. Internationalization

      17.1 Localizing Request/Response Encoding  

      17.2 Providing Multiple Language Support  

      17.3 Using Global Resources and Overriding Currency Formatting  

18. File Operations

      18.1 Downloading a File from the Web Server  

      18.2 Uploading a File to the Web Server  

      18.3 Processing an Uploaded File Without Storing It on the Filesystem  

      18.4 Storing the Contents of an Uploaded File in a Database  

19. Performance

      19.1 Reducing Page Size by Selectively Disabling the ViewState  

      19.2 Speeding Up String Concatenation with a StringBuilder  

      19.3 Speeding Up Read-Only Data Access  

      19.4 Speeding Up Data Access to a SQL Server Database Using the SQL Provider  

20. HTTP Handlers

      20.1 Creating a Reusable Image Handler  

      20.2 Creating a File Download Handler  

21. Assorted Tips

      21.1 Accessing HTTP-Specific Information from Within a Class  

      21.2 Executing External Applications  

      21.3 Transforming XML to HTML  

      21.4 Determining the User's Browser Type  

      21.5 Dynamically Creating Browser-Specific Stylesheets  

      21.6 Saving and Reusing HTML Output  

      21.7 Sending Mail  

      21.8 Dynamic Menus  

      21.9 Adding Breadcrumbs  

Index