Home Page Icon
Home Page
Table of Contents for
I. Building Web Form Pages
Close
I. Building Web Form Pages
by Stephen Walther
ASP.NET Kick Start
Copyright
Dedication
About the Author
Acknowledgments
We Want to Hear from You!
Introduction
Who Should Read This Book?
How This Book Is Organized
What Do You Need to Know Before Reading This Book?
Conventions Used in This Book
I. Building Web Form Pages
1. Getting Familiar with the Development Environment
Creating a Simple Web Forms Page
Working with Solutions and Projects
Creating Projects
Creating Solutions
Accessing Project Files
Upgrading Existing Applications to Visual Studio .NET
Working with Projects Offline
Overview of Visual Studio .NET Windows
Using Auto Hide
Using the Start Page
Using the Solution Explorer Window
Adding Files and Folders to a Project
Copying and Moving Items in a Project
Displaying All Items in a Solution
Copying a Project
Using the Toolbox
Controlling How Toolbox Items Are Displayed
Adding New Items to the Toolbox
Adding New Tabs to the Toolbox
Using the Server Explorer
Using the Properties Window
Using the Visual Studio .NET Designer
Using the Visual Studio .NET Code and Text Editor
Taking Advantage of IntelliSense
Navigating Code
Using the Navigation Bar
Moving to a Line Number
Moving to a Definition
Searching for Text
Using Bookmarks
Outlining Code
Customizing the Code Editor
Selecting Tab or Multiple Document Interface Mode
Modifying the Code Editor Font
Displaying Line Numbers
Displaying the Code Editor in Full-Screen Mode
Using the Task List Window
Displaying Tasks for the Current File
Adding Code Comments to the Task Lists
Tracking Code Errors
Adding User Comments
Adding Shortcuts to the Task List
Automatically Documenting Your Code
Summary
2. Using the Visual Studio .NET Designer
Creating a New HTML Page
Previewing an HTML Page in a Browser
Switching Between Design View and HTML View
Setting the Target Schema Property
Working with HTML Pages in Design View
Selecting Flow or Grid Layout Mode
Adding HTML Elements to a Page
Designing an HTML Page in Flow Layout Mode
Designing an HTML Page in Grid Layout Mode
Displaying a Grid
Using Snap to Grid
Aligning Elements in Grid Layout Mode
Layering Elements in Grid Layout Mode
Mixing Flow and Grid Layout Modes
Formatting Text
Setting Background and Margin Properties
Adding Images
Adding Hypertext Links
Adding a Bookmark
Adding Form Elements
Adding Text Fields
Adding Password Fields
Adding Text Areas
Adding Radio Buttons
Adding Check Boxes
Adding Drop-Down Lists and List Boxes
Adding Buttons
Adding File Fields
Adding Hidden Fields
Adding Tables
Adding Framesets
Assigning Pages to Frames
Linking to a Page in a Frame
Modifying Frameset Properties
Working with HTML Pages in HTML View
Taking Advantage of Automatic Statement Completion
Enabling and Disabling Automatic Formatting
Validating HTML Documents
Using the Document Outline
Adding Client-Side Scripts
Adding Style Sheets
Adding Style Attributes Inline
Adding a Style Block to a Page
Creating External Style Sheets
Summary
3. Creating Basic Web Form Pages
Overview of Web Form Pages
Creating a Simple Web Form Page
The Two Parts of a Web Form Page
Compiling and Viewing Web Form Pages
Adding Server Controls
Using HTML Controls
Using Web Controls
Adding Label Controls
Adding Button Controls
Adding TextBox Controls
Adding List Controls
Using the AutoPostBack Property
Grouping Controls with Panels
Formatting Web Controls
Handling Events
Handling Control Events
Handling Page Events
The IsPostBack Property
Summary
4. Validating Web Form Pages
Overview of the Validation Controls
Post Backs and Form Validation
JavaScript and the Validation Controls
Using Validation Controls
Checking for Required Fields
Validating a Range of Expressions
Comparing Values
Performing Data Type Checks
Regular Expression Validation
Performing Custom Validation
Displaying a Summary of Validation Errors
Summary
5. Creating Web User Controls
Creating a Simple Web User Control
Handling Events in a Web User Control
Building Form Elements with Web User Controls
Dynamically Loading Web User Controls
Summary
6. Debugging Your Web Form Pages
Building Your Project
Building in Debug and Release Mode
Explicit and Dynamic Compilation
Displaying Errors in Your Application
Using the Visual Studio .NET Debugger
Adding Breakpoints
Stepping Through Code
Debugger Windows
Adding Watches
Debugging and Exceptions
Debugging Client-Side Script
Debugging SQL
Page and Application Tracing
Using Page Tracing
Placing Trace Messages in Different Categories
Tracing and Exceptions
Programmatically Enabling Tracing
Using Application Tracing
Summary
II. Working with Database Data
7. Using the Visual Database Tools
Visual Database Tools Support in Different Editions of Visual Studio .NET
Working with Database Objects in Server Explorer
Browsing Database Objects with Server Explorer
Retrieving and Modifying Data with Server Explorer
Creating New Databases with Server Explorer
Creating New Database Tables with Server Explorer
Creating New Database Views with Server Explorer
Creating New Stored Procedures with Server Explorer
Creating New Triggers with Server Explorer
Creating New Database Functions with Server Explorer
Designing Databases with Database Diagrams
Creating a New Database Diagram
Creating New Tables with Database Diagrams
Controlling How Tables Are Displayed
Visually Specifying Relationships
Adding Annotations to a Database Diagram
Controlling Page Breaks in a Database Diagram
Working with Database Projects
Creating a New Database Project
Creating Database References
Creating SQL Scripts
Creating SQL Queries
Summary
8. Overview of ADO.NET
The Three Dualities of ADO.NET
OleDb Versus SqlClient
DataSets Versus DataReaders
Relational Versus XML Views
Creating Database Connections
Using DataSets, DataAdapters, and DataViews
Displaying Database Data with a DataSet
Displaying All Rows with a DataSet
Using a Typed DataSet
Using DataViews
Using DataReaders and Commands
Displaying Database Data with a DataReader
Caching Data for Better Performance
Using the Cache Object
Caching a DataSet in Memory
Summary
9. Saving Form Data
Overview of the Command Object
Creating an SqlCommand Object
Creating an OleDbCommand Object
Executing Commands with Parameters
Using Parameters with the SqlCommand Object
Using Parameters with the OleDbCommand Object
Executing Commands with Stored Procedures
Executing a Simple Stored Procedure
Stored Procedures and Return Values
Stored Procedures and Output Parameters
Creating a Pizza Order Form
Summary
10. Using List Controls
Overview of the List Controls
Adding List Items with the ListItem Collection Editor
Adding List Items Programmatically
Adding List Items with Databinding
Retrieving the Selected List Item
Enabling AutoPostBack
Displaying Database Data in a List Control
Working with Multi-Select List Controls
Advanced List Control Topics
Adding a Default List Item
Displaying a Default List Item
Creating Interactions Between List Controls
Summary
11. Displaying Data with the Repeater Control
Binding the Repeater Control to Database Data
Using Templates with the Repeater Control
Formatting the Output of a Databinding Expression
Loading Templates from an External File
Adding Child Controls to the Repeater Control
Summary
12. Displaying Data with the DataList Control
Binding the DataList Control to Database Data
Using Templates with the DataList Control
Formatting the Appearance of a DataList
Formatting the Borders in a DataList Control
Using Auto Formatting with the DataList Control
Creating a Multicolumn DataList
Creating a Menu with a DataList
Using the DataKeys Collection
Creating a Single-Page Master/Detail Form
Summary
13. Displaying Data with the DataGrid Control
Automatically Displaying the Contents of a Database Table
Customizing the Appearance of the DataGrid Control
Applying Auto Formatting to a DataGrid
Specifying Columns in a DataGrid
Displaying HyperLink Columns in a DataGrid
Sorting Data in a DataGrid
Using Caching with Sorting
Performing Ascending and Descending Sorts
Paging Through Records in a DataGrid
Customizing the Paging User Interface
Using Caching with Paging
Editing Database Records in a DataGrid
Editing with Bound Columns
Adding a Delete Button to the DataGrid Control
Using Smart Navigation with a DataGrid
Editing with Template Columns
Summary
III. Working with ASP.NET Applications
14. Improving Application Performance with Caching
Using Page Output Caching
Using the VaryByParam Attribute
Using Controls in a Cached Page
Using the VaryByHeader Attribute
Using the VaryByCustom Attribute
Specifying the Cache Location
Using Partial Page Caching
Using Controls in a Cached Web User Control
Using Properties in a Cached User Control
Using Data Caching
Adding and Removing Items from the Cache
Using File Dependencies
Using Expiration Policies
Setting Item Priorities
Summary
15. Configuring Your Application
Overview of the Machine.Config and Web.Config Files
Configuration Sections
The <configSections> Section
The <appSettings> Section
The <system.diagnostics> Section
The <system.net> Section
The <system.web> Section
The <trace> Element
The <globalization> Element
The <httpRuntime> Element
The <compilation> Section
The <pages> Element
The <customErrors> Section
The <authentication> Section
The <identity> Element
The <authorization> Section
The <machineKey> Element
The <securityPolicy> Section
The <sessionState> Element
The <httpHandlers> Section
The <httpModule> Section
The <processModel> Element
The <webControls> Element
The <clientTarget> Section
The <browserCaps> Section
The <webServices> Section
Adding Custom Configuration Information
Using the <appSettings> Section
Creating a Custom Section Handler
Advanced Configuration Topics
Applying Configuration Settings to a Particular File
Locking Configuration Settings
Summary
16. Securing Your Application
Overview of Forms Authentication
Authentication and Authorization
Enabling Forms Authentication
Creating a Simple Login Page
Retrieving the Username
Creating a Sign Out Link
Storing Usernames and Passwords in the Web.Config File
Storing Usernames and Passwords in a Database Table
Adding a Registration Page
Implementing Custom Roles with Forms Authentication
Summary
17. Maintaining Application State
Using View State
How View State Really Works
Disabling View State
Adding Custom Information to View State
Protecting View State
Using Session State
Configuring Out-of-Process Session State
Storing Session State in a Windows Service
Storing Session State in a SQL Server Database
Enabling Cookieless Sessions
Using Application State
Summary
18. Handling Application-Wide Events
Using the Global.asax File
Handling Application-Wide Errors
Rewriting Page Requests
Detecting the Start and End of a User Session
Implementing Custom Caching
Using Custom HttpModules
Creating the Cookieless Authentication Modules
Creating the Performance Logging Module
Summary
19. Deploying Your Application
Web Application Deployment Overview
Things You Should Check Before Deployment
Creating Web Setup Projects
Modifying Properties of a Web Setup Project
Modifying the User Interface of the Web Setup Project
Summary
IV. Components, Web Services, and Custom Controls
20. Building Business Components
Why Use Components?
Components Versus Classes
Creating a Simple Component
Creating Components with Static/Shared Methods
Adding Properties to a Component
Creating a Database Component
Using DataReaders with Components
Creating Multi-Tiered Applications
Creating a Library of Components
Adding Components to the Toolbox
Accessing the Current HttpContext in a Component
Summary
21. Building XML Web Services
What Is a Web Service?
ASP.NET Web Services
Creating a Simple ASP.NET Web Service
Invoking a Web Service from a Web Form Page
Web Services and Namespaces
Exposing Database Data Through a Web Service
Exposing a Custom Object Through a Web Service
Advanced Web Service Topics
Handling Errors When Calling Web Methods
Caching the Output of Web Methods
Using Dynamic Discovery
Summary
22. Creating Custom Web Form Controls
Custom Web Form Controls Versus Web User Controls
Overview of Custom Web Form Controls
Creating a Simple Non-Composite Control
Using the HtmlTextWriter Class
Creating a Non-Composite Content Rotator Control
Creating a Simple Composite Control
Using the INamingContainer Interface
Using Render with Composite Controls
Composite Controls and Designer Support
Creating a Composite Address Form Control
Adding Designer Support to a Custom Web Form Control
Using Design-Time Attributes
Controlling the Appearance of a Custom Control in the Toolbox
Using the ControlDesigner Class
Summary
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Introduction
Next
Next Chapter
1. Getting Familiar with the Development Environment
Part I. Building Web Form Pages
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset