Pro ASP.NET Web Forms Techniques

    Alex Homer (alex@stonebroom.com)

 

ASP.NET makes it easy to create interactive and intuitive interfaces for Web applications, and attractive and exciting Web pages. The server-based post-back architecture, combined with the comprehensive array of server controls that are provided as part of the .NET Framework, allow developers to quickly build browser-based interfaces for Web sites and Web applications - using much the same event-driven approach as in "traditional" executable programs developed in languages like Visual Basic, Delphi and C++.

 

This is a completely new and different way of working from previous versions of ASP, and the underlying principles and workings of server-based events, which occur in response to actions made by the user in the page, can prove to be difficult to grasp in its entirety. However, constructing ASP.NET pages, especially with some of the tools that are available or under development now, is very much easier and often less error-prone than in classic ASP.

 

However, a completely server-based approach to user interaction does have its downsides. In high-latency scenarios, or over slow network connections, the need to hit the server every time that the page content needs to be modified can intrude on the working of an application, or reduce the perceived responsiveness of a Web site.

 

Although the ASP.NET philosophy tends to engender a server-based mechanism, where post-backs to the server are used to generate and update the pages, some of the server controls (notably the Validation controls) also encompass client-side interactivity through JScript that is sent to the client for execution there.  And there is no reason why a developer cannot add to this functionality for other controls by handling client-side events in the same way as has become the norm in most Web sites and Web applications today.

What Is This Book About?

So, based on the title and the preamble above, you can safely assume that this book is aiming to examine the possibilities for developing user interfaces that are driven by ASP.NET. It attempts to discuss and explore a range of techniques and approaches predominantly for creating Web sites and Web pages that are:

 

*        Intuitive and easy to use

*        Attractive and full-featured

*        Interactive where this is appropriate

*        Based (loosely) on a real-world scenario

*        Fulfill a predefined set of design requirements

*        Are fun, memorable, and provide user satisfaction

 

The pages we build are, for the most part, elements of an overall application that - while being somewhat optimistic as regards consumer buying patterns - does form the basis for the kind of Web site/application that is becoming one of the basic ingredients of the World Wide Web today. We'll be building a site that allows the user to choose, customize and purchase a new car or truck from the world-famous "Wrox Car Company".

 

To do so, we'll focus on the steps of requirements-analysis and design (though not in extreme detail), followed by planning and mapping out the site. While this seems like the natural way to get started, it's often skimped or even omitted, allowing the site to develop in a haphazard and unpredictable way. While this is not always categorically wrong, it does make development and maintenance that much more difficult. Even the most simplistic "starting plan" can reduce development and maintenance time, as well as avoiding many common frustrations that result from the "no plan" approach.

 

Once the basic design in is place we'll look at the development of the various resources that make up the complete site. Of course, repetition is commonplace in a Web site, and so to make the book as useful as possible we've taken some liberties to try and cover as many useful topics as possible. It means that we can look at a range of things such as:

 

*        A central "Home page" that makes navigation of the whole site easy

*        Displaying data about the products available from the site from a backend database

*        Interactive content that driven by either or both server-side and client-side code

*        Creating graphics on the fly, and other animations to liven up the site

*        A "login" feature that recognizes users and provides optional personalization

*        An online order facility with order tracking and status reports via email

*        Some ASP.NET development tools that are available now, or are on the way

 

What we won't be doing is concentrating on the backend data processing tasks in any more detail than we need to in order to get the site running. In a sister publication, "ASP.NET Distributed Data Applications" (Wrox ISBN: 1-861004-92-3), we covered the whole reasoning behind, and implementation of n-tier architectures and componentized design. In that book, however, we steered clear of as much complexity in the client as possible, in order to concentrate on the data processing aspects.

 

On the grounds that we don't have 1500 pages available here, this book does the reverse by concentrating on the user interfaces, and using fairly simple data access techniques. Of course, that doesn't mean we won't be doing it "properly", it just means that you won't see detailed discussions of the workings of all of the .NET data access classes, or the long diatribes on catching and reporting concurrency errors.

 

All ASP.NET the code you see listed in the book, with the exception of simple abstract snippets that demonstrate a specific principle or just show the syntax, is available in both VB.NET and C#. The listings you see in the book are mostly written using VB.NET syntax, but avoiding and language-specific features wherever possible, so that it can easily be converted to other languages by any reasonably capable developer who prefers to work in a different language. Where there is an obvious difference between VB.NET and C# in the way that a specific feature is implemented, we show the C# version as well.  Meanwhile, the client-side code is predominantly written in JavaScript/JScript.

 

You can download all the code for this book from: http://www.wrox.com/. You can also run many of the examples online on our server. For details go to: http://www.daveandal.net/da/books/7868/

 

If you worked with ASP 2.0 and/or 3.0, and read either of the previous Wrox "ASP Webmaster" books, you'll find that this book is somewhat similar to those in both the kinds of topics it covers, and the approach to these topics that it takes. But, of course, now we're talking about ASP.NET - and so the range of possibilities and the fundamental implementation are very different.

Who Is This Book For?

As is becoming clear, ASP.NET and the accompanying .NET Framework class library are far more comprehensive - and complex - than anything we used in ASP 3.0 or earlier (or, in fact, in other environments like PHP and JSP). The result is that it's not possible for every ASP.NET book to cover an introduction or brief tutorial to ASP.NET as well as the more advanced content that forms the core of the book.

 

Mind you - this is a good thing from your point of view, as you don't want to pay for material that covers topics you are already familiar with. What is does mean is that you do need to be familiar with ASP.NET and, to some extent, the .NET Framework classes to be able to use this book successfully. We assume that you have already installed and are using ASP.NET to build pages, perhaps using a text editor or with Visual Studio .NET or another development tool.

 

We also assume that you have a reasonable grasp of using a database to drive a Web site. We'll explain the data access code we use, how it works, and discuss alternatives where appropriate. But we won’t be covering the basic techniques for setting up and administering your database.

What This Book Is Not

*        It's not a dry reference book on any particular area of the technologies.

*        It's not an academic text that follows every thread or aspect of any one technology.

*        It's not about hardware performance or software configuration for ASP.NET.

*        It's not about SQL programming, server optimization or data access theory.

*        It's not aimed at system or database administrators - it's aimed at developers.

What This Book Is

*        It is a practical approach aimed at achieving useful goals without drowning in complexity.

*        It is a guide to many of the useful and powerful interface-oriented features of ASP.NET.

*        It is an exploration of a process for designing and building an interactive Web site.

*        It is a useful introduction to many peripheral techniques, such as drawing and email.

*        It is a demonstration of how easy ASP.NET makes building great Web sites.

*        It is, hopefully, informative, useful, and fun to read.

What Do You Need To Use This Book?

Providing that your level of experience and knowledge meets the not excessive requirements of the earlier sections, the only other things you need are:

 

*        A development environment. At minimum your favorite text editor, or perhaps Visual Studio .NET, Microsoft ASP.NET Web Matrix, or any other suitable tool from a third party manufacturer.

*        Internet Information Server and the .NET Framework installed and configured on a server that you can access. Alternatively, if you are using Matrix, you can take advantage of its built-in Web server. We also recommend that you install the complete version of the .NET SDK that includes all the reference material, as it makes it easy to look up specific items when you aren't using Visual Studio .NET.

*        A database such as Microsoft SQL Server or MSDE, although you can use any other SQL database system - or even a desktop database such as Microsoft Access - as long as there is a .NET Data Provider available so that it an be accessed via ASP.NET.

For development and experimentation you can run the database, IIS and .NET and your chosen development environment on the same machine. This often makes debugging easier as well.

Chapter List

1 - Getting Started

·          Why ASP.NET?

·          A Note on Terminology

·          Is It a Bird? ... Is It a Plane? ... No, it's a Wapplisite!

·          ASP.NET Fundamentals

·          Event-Driven Applications

·          Programming Dynamic Pages On The Web

·          Event-Driven Programming On The Web

·          The ASP.NET Page as a Compiled Class

·          The ASP.NET Postback Architecture

·          Posting To The Same Page

·          Server-side ASP.NET Forms

·          Emulating Individual Control Events

·          Server-side and Client-side Event Handling

·          Control Values and ViewState

·          Using Viewstate as a Storage Medium

·          Disabling Viewstate

·          Preventing a Page Reload

·          ASP.NET Server Controls

·          Server-side Data Binding

·          Other Useful ASP.NET Features

·          ASP.NET Sessions

·          ASP.NET Caching

·          ASP.NET Authentication and Authorization

·          Designing an Interactive Web Site

·          The Overall Site Design

·          Requirements Analysis

·          The Basic Site Structure

·          The Wrox Car Company

·          The Data Source

·          Client-side Processing

·          The Home Page

·          The Ingredients for the Home Page

·          The Car Model Details Page

·          The Color Options Section

·          Using a Frameset

·          Other Approaches

·          The Ingredients for the Color Options Section

·          The Engine Options Section

·          The Ingredients for the Engine Options Section

·          The Optional Extras Section

·          The Ingredients for the Optional Extras Section

·          The Model Details Section

·          The Ingredients for the Model Details Section

·          The Finance Options Section

·          The Ingredients for the Finance Options Section

·          The Compare Features Page

·          The Ingredients for the Compare Features Page

·          The Order Pages

·          Other "Peripheral" Pages

·          Is It All Actually Achievable?

·          Summary

2 - Browser Compatibility with ASP.NET Server Controls

·          Built-in Intelligence

·          A Test Application

·          Use A Selection of Browsers

·          Viewing the Test Pages

·          The Hyperlink Server Control

·          But Navigator Understands the Style Attribute!

·          The Calendar Control

·          Specifying Up-level or Down-level Clients

·          The Definition of "Up-level" and "Down-level"

·          List Control Formatting and Templates

·          The Output from the DataList Control

·          Adding Templates to the DataList Control

·          More Complexity - the DataGrid Control

·          Specifying Column Information in a DataGrid Control

·          Formatting Within a TemplateColumn in a DataGrid Control

·          What If There's No Client-side Script Support?

·          Example: A LinkButton in Amaya

·          Solving the "No Script" Problem

·          When Scripting is Supported but Disabled

·          The ASP.NET Validation Controls

·          The Validation Controls in Down-level Clients

·          The ASP.NET Panel Control

·          The Panel Control in Down-level Clients

·          Don't Get Caught Out by Output Caching

·          Caching by Browser Version

·          Caching by Client Target

·          Summary

3 - Laying The Foundations

·          Obtaining the Example Files

·          Installing the Wrox Car Company Site

·          Wrox Cars Client-side Technical Requirements

·          What "Standards" Do We Support or Require?

·          ASP.NET Sessions

·          Requirements for Session Support

·          Cookies, Cookie-less Sessions and URL Munging

·          The Session ID and Session Timeout

·          Session Support Across Multiple Servers

·          Using the ASP.NET State Service

·          Using SQL Server for Session Support

·          Maximizing Performance When Using Sessions

·          Client-side Scripting

·          Users and User IDs in the Wrox Car Company Site

·          Checking for Sessions and Scripting Support

·          Client Capabilities and User ID Detection

·          The Code in default.aspx

·          The HTML and Content in default.aspx

·          The no-script.htm Page

·          Enabling and Disabling Client-side Scripting

·          The Detection Code in home.aspx

·          The no-sessions.htm Page

·          Cookie Based or Cookie-less Sessions?

·          Enabling and Disabling Cookie Support

·          Cross-Browser Compatibility Issues

·          Browsers for Testing Your Pages

·          Other User Agents

·          Solving Browser Compatibility Issues

·          Techniques For Maximizing Compatibility

·          Declaring and Linking to CSS Style Sheets

·          Font Styles, Types and Sizes

·          Using Pre-defined Font Sizes

·          Font Names and Colors

·          ASP.NET Server Controls and the CssClass Property

·          Layout of Page Sections and Individual Elements

·          Different Screen Resolutions and Text Sizes

·          Removing Excess White Space in Page Margins

·          Removing Excess White Space from Text in Block Elements

·          Script-driven Animations and Other "Actions"

·          Client-side Browser Feature Detection

·          Coping with Navigator/Communicator 4.x.

·          Making Sites Accessible to All Visitors

·          Why Provide Universal Accessibility?

·          A Summary of Techniques for Accessibility

·          Assisting Navigation

·          Identifying Elements

·          General Recommendations

·          Summary

4 - The Home Page

·          The Overall Page Structure

·          Creating the Page Structure

·          The HTML Table for the Outline Structure

·          The <form> Section

·          The <body> Element as a Server Control

·          The HtmlGenericControl Class

·          Setting the Styles for the Page

·          Specifying the CSS Style Sheet

·          The Standard Style Sheet

·          The Netscape/Mozilla Style Sheet

·          Detecting the Client Type

·          Linking to the Correct Style Sheet

·          Providing Accessibility Navigation Aids

·          Implementing "Skip To" Links

·          The Source Code for the "Skip To" Links

·          Hiding "Skip To" Links in Graphical Browsers

·          Remember those "title" and "alt" Attributes

·          The Links to Other Pages

·          The ASP.NET Hyperlink Control

·          Setting the "title" and "alt" Attributes

·          The "News and Special Offers" Section

·          The Data Access Code for the "News" List

·          The GetNewsList Stored Procedure

·          The GetNewsListDR Function

·          The CommandBehavior Parameter for the ExecuteReader Method

·          Data Binding the Repeater Control

·          Choosing the Appropriate ASP.NET "List" Control

·          The Static Section of the "News" List

·          The ASP.NET Repeater Control for the "News" List

·          Data Binding Syntax in a List Control Template

·          The List of Car Models

·          Choosing the Appropriate List Control

·          Changing the Behavior for Script-Enabled Clients

·          The Data Access Code for the "Car Models" List

·          The GetModelList Stored Procedure

·          The GetModelListDR Function

·          Data Binding the DataGrid Control

·          The DataGrid Control for the "Car Models" List

·          Specifying Styles and Templates

·          Specifying Column Information in a DataGrid Template

·          The Graphic Image and Price Column

·          The Name and Description Column

·          Handling the ItemDataBound Event for a DataGrid

·          The SetNavigateUrl Event Handler

·          Session IDs for Cookie-less Sessions

·          Summary

5 - Banners, Footers and Email

·          About ASP.NET User Controls

·          Reusable Code and Content

·          Building a User Control

·          The Contents of a User Control

·          Exposing Properties from a User Control

·          Using a User Control in an ASP.NET Page

·          Setting Properties

·          The Animated Page Banner

·          Building the Animated Banner Control

·          The Structure of the "Page Banner" User Control

·          The ASP.NET Literal Control

·          The Properties of our User Control

·          The Page_Load Event Handler

·          Selecting the Content Block to Send to the Client

·          The Animation Content for CSS-Enabled Clients

·          Animating the Banner

·          Moving the Images

·          The Animation Content for Internet Explorer 4.x and above

·          The Animation Content for Netscape 4.x only

·          Moving the Layer Elements

·          Using the Animated Banner Control

·          Setting the Banner Control Properties

·          The Page Footer Section

·          Dynamic Hyperlinks in the Footer

·          Building the Page Footer Control

·          The HtmlAnchor Control

·          The Code for the Page Footer Control

·          Using the Page Footer Control

·          Adding Users to the Mailing List

·          The Controls to Submit an Email Address

·          ASP.NET Form Controls and the <form> Element

·          ASP.NET Validation Controls

·          The Validation Control Members

·          The Validation Controls in the "Home" Page

·          Displaying the Validation Control Content

·          The Validation Summary Control in the "Home" Page

·          Online Server Controls Examples

·          The Code to Handle Email Addresses

·          Using the Page.IsValid Property

·          The UpdateMailingList Function

·          Executing the AddMailingListAddress Stored Procedure

·          The SendEmailConfirmation Routine

·          Creating a MailMessage Object

·          Using the SmtpMail Class to Send the Message

·          Configuration Issues for Sending Mail from ASP.NET

·          Summary

6 - The Ancillary Pages

·          The Ancillary Pages

·          The Structure of the Ancillary Pages

·          The Overall Layout

·          "Terms & Conditions" and "Contact" Pages

·          The HTML Table for the Ancillary Pages Structure

·          The Code for the Ancillary Pages

·          Redirection When No Session Is Available

·          The MainLink User Control

·          The Script Section

·          Using the MainLink Control

·          Choosing Static or Dynamic Content

·          Making Static Content Dynamic

·          Dynamic Content Without a Database

·          Making Dynamic Content Static

·          Generating Static Pages with ASP.NET

·          Using ASP.NET Caching to Expose "Static" Pages

·          The "Read News Item" Page

·          Inserting Dynamic Content into Pages

·          The HTML and Code for the "Read News" Page

·          Getting the Content from the Data Store

·          Inserting the Content into the Page

·          Why Use <p> Elements?

·          Extracting Values from a DataReader

·          DataReader Methods that Return .NET Data Types

·          DataReader Methods that Return SQL Server Data Types

·          DataReader Methods that Return Information About the Data

·          The "Compare Models" Page

·          Accessibility Issues with Complex Images

·          Using a Long Description

·          Complex Images in Hyperlinks

·          Adding a "Long Description" Attribute with ASP.NET

·          Using a "D Link" Hyperlink

·          Providing Alternate Content Formats

·          Building the "Compare Models" Page

·          The "Skip To" Links

·          The Main Page Structure Table

·          The Controls to Selection the Comparison Type

·          The CheckBoxList Control Versus The RadioButtonList Control

·          Getting the Values of CheckBoxList and RadioButtonList Controls

·          The Controls to Display the Results of the Comparison

·          The Controls to Display the Graphical Chart

·          The Controls to Display an HTML Table of the Results

·          The Invisible Submit Button

·          The Code To Make It All Work

·          Summarizing the Requirements

·          The Page-Level Variables

·          The Page_Load Event Handler

·          Checking for a PostBack

·          Managing and Using the ViewState

·          Setting the CheckBox Controls

·          Getting the Car and Engine Data

·          The GetModelEngineCombinedList Stored Procedure

·          Populating the CheckboxList of Models and Engine Types

·          Generating the Comparison Results

·          The ShowComparison Routine

·          Creating the ASP.NET Image Element for the Chart

·          Creating the HTML Table of Results

·          SQL Statement or Stored Procedure?

·          Generating the Required SQL Statement

·          Specifying the WHERE Clause

·          Getting a DataReader of Results for the DataGrid

·          Creating the Chart Image URL and Query String

·          Testing for Accessibility

·          Using a Text-Only Browser

·          Using an Aural Page Reader

·          Summary

7 - Creating Graphs and Charts

·          Creating Graphs and Charts

·          Dynamically Generated Graphics and Images

·          Using Dynamic Images in Web Pages

·          Alternative Elements for Inserting Images

·          Using Multiple Static Image Files

·          Passing Values to an Image Generation Page

·          The .NET Framework Drawing Classes

·          The System.Drawing Class

·          It's All Very Simple

·          Creating a Simple Pie Chart

·          Providing the Data Source

·          Creating the DataSet for the Pie Chart Example

·          The Pie Chart Example Page

·          Adding the Import Directives

·          The Page_Load Event Handler

·          Drawing Text on a Bitmap

·          A Custom Routine to Draw Text Strings

·          Formatting and Drawing the Text

·          Using our Custom DrawText Routine

·          Creating and Using Colors in Images

·          Color Modes and Color Palettes

·          The Browser Safe and Standard Colors

·          How the "Browser-safe Colors" Page Works

·          Creating the Arrays of Colors

·          Creating the Rows for Each Table

·          Creating the Cells for Each Table Row

·          Displaying the Color and Color Details

·          Starting a new Row

·          Our Generic Pie Chart Routine

·          Calculating the Position of the Main Chart Elements

·          Creating Rectangles and Drawing Shadows

·          Declaring More Variables and Totalling the Rows

·          Drawing the Pie Slices

·          The DrawPie and FillPie Methods

·          Adding the Key and Caption

·          Completing the Loop

·          A Note About Saving a BitMap

·          The Vehicle Comparison Charts

·          Getting the Values and Data for the Chart

·          Creating the SQL Statement

·          Drawing the Appropriate Chart

·          Drawing the Line Chart

·          Declaring the Variables We'll Need

·          Creating Arrow Caps for the Axes

·          Drawing the Y-Axis Values

·          Drawing the X-Axis Values

·          Drawing the Value Lines

·          Drawing the "Key" Boxes and Descriptions

·          Drawing the Bar Chart

·          The Routine Parameters and Variable Declarations

·          Drawing the Axes and "Key" Boxes

·          Calculating the X-Axes Values

·          Drawing the X-Axes Values

·          Drawing the Y-Axes Values

·          Drawing the Bars onto the Chart

·          Summary

8 - Interactive Web Forms

·          Meeting the Design Requirements

·          The Original Design

·          Selecting a Color for the Vehicle

·          Selecting the Engine for the Vehicle

·          Selecting the Optional Extras for the Vehicle

·          Viewing the Standard Features of the Vehicle

·          Selecting a Finance Package for the Vehicle

·          Supporting "No-script" Clients

·          Supporting "Text-Only" Clients

·          Supporting "Page-Reader" Clients

·          Saving Quotations and Closing the Window

·          The Navigation Issue in Lynx

·          The Model Details Page in Outline

·          Opening the Model Details Page

·          Using the Postback Architecture

·          A Schematic of the Whole Process

·          Calculating the Price and Finance Terms

·          Storing the Price and Finance Terms

·          Detecting Control Events and Updating the Page Content

·          Using Auto-Postback to Drive the Page

·          What Happened to the Frames?

·          Implementing a "Tabbed Dialog"

·          About the IE Web Controls

·          Fallback Support for Older Browsers

·          Coping Without Client-side Scripting Support

·          Client-side Versus Server-Side Page Updates

·          An Example - Changing the Color of the Car

·          The Conclusion

·          Saving Quotations and Orders

·          The Structure of the Model Details Page

·          Importing and Registering the IE Web Controls

·          The HTML Section of the Page

·          The Model Description, Price and Image

·          The "Tabbed Dialog" Section

·          The TabStrip Control

·          Using Images with a TabStrip Control

·          The MultiPage Control

·          Linking the TabStrip and MultiPage Controls

·          What Output do the TabStrip and MultiPage Controls Create?

·          The TabStrip and MultiPage Controls in Down-level Clients

·          The Information and Error Messages Label

·          The Instructions, Save and Close Buttons

·          The Client-side mainWindowPage Function

·          Using the ASP.NET RegisterClientScriptBlock Method

·          Other ASP.NET "Register" Methods

·          Summary

9 - Interactive Model Details

·          The Data for the Model Details Page

·          The Vehicle Details Database Tables

·          But in the Real World...

·          The Stored Procedures for the Model Details Page

·          Extracting the Vehicle Details

·          Extracting the List of Available Colors

·          Extracting the List of Available Extras

·          The Finance PMT Values Table

·          Using global.asax to Handle Application-Level Events

·          Running Code on Application Startup

·          The Application_Start Event Handler

·          Calculating the Payment Amounts

·          The VB.NET PMT Function

·          Writing Status Messages to the Event Log and a Text Log File

·          The WriteEventLogMessage Routine

·          The WriteErrorFileMessage Routine

·          Running Code when an Application Error Occurs

·          The GetFinancePMTRates Stored Procedure

·          Fetching and Storing the Data for the Page

·          Accessing the Database and Filling the DataSet

·          Saving the DataSet in the Session

·          The Code in the Model Details Page

·          The Page_Load Event Handler

·          Checking for an Active Session

·          Collecting the DataSet

·          Collecting the Price and Finance Terms

·          Saving Values in the ViewState of the Page

·          The Model Details "Tab" Pages in Detail

·          The Color Selection Section

·          Displaying the Color Blocks

·          Where Do the Colors Come From?

·          Populating the Page Heading and Colors Section

·          Displaying the Appropriate Set of Colors

·          Reacting to Events in the Colors Section

·          The Engine Selection Section

·          The Engine Details (DataGrid) Table

·          Populating the Engine Section

·          Reacting to Events in the Engine Section

·          The Optional Extras Selection Section

·          Populating the Extras Section

·          Reacting to Events in the Extras Section

·          The Standard Features (Details) Section

·          The IE Web Controls TreeView Control

·          The Declarative Source Format for a TreeView Control

·          Data-binding an XML Data Source File to a TreeView Control

·          Reacting to TreeView Events

·          The HTML for the Details Section

·          The Behavior of the TreeView Controls in the Model Details Page

·          Populating the Details Section

·          Reacting to Events in the Details Section

·          The Client-Side nodeExpanded Event Handler

·          The Finance Package Selection Section

·          Enabling and Disabling Buttons and Other Controls

·          Populating the Finance Section

·          Reacting to Events in the Finance Section

·          Reacting to Client-Side Events in the Finance Section

·          Summary

10 - Car Prices and Quotations

·          Calculating the Price of the Vehicle

·          The CalculateCarPrice Routine

·          Clearing Any Existing Finance Terms

·          Getting the Price for the Current Car/Engine Combination

·          DataTable.Select versus DataView.RowFiler

·          Adding the Extra Cost for a Metallic Color

·          Adding the Cost of Optional Extras

·          Storing the Total Price in the Prices Array

·          Calculating the Finance Terms

·          The ShowFinanceTerms Routine

·          Handling an Error in the Calculation

·          The CalculateFinanceTerms Function

·          Processing the "Maximum Monthly Payment" Finance Package

·          Processing the "Number of Months" Finance Package

·          Calculating the Interest and Filling the Prices Array

·          The GetNumberPayments Function

·          Finding the Matching Table Row

·          The ClearFinanceTerms Routine

·          Saving the Configuration as a Quotation

·          The Saved Quotes and Orders Tables

·          Updating the Data within a Transaction

·          Saving a Quotation

·          The Stored Procedures for the SaveCarDetails Routine

·          The SaveCarDetails Routine

·          Fetching the Price and Finance Values

·          Fetching the Engine and Color Details

·          Preparing to Execute the Stored Procedures

·          Starting a Transaction

·          Adding the InsertNewQuote Stored Procedure Parameters

·          Executing the InsertNewQuote Stored Procedure

·          Adding the InsertNewQuoteExtraLine Stored Procedure Parameters

·          Iterating Through the Selected Optional Extras

·          Committing or Rolling Back the Transaction

·          Displaying the Result

·          The No-Script Version of the Page

·          Avoiding the TabStrip and MultiPage Controls

·          Custom Multi-Page Effects

·          Our Solution - Use Hyperlinks and Horizontal Rules

·          Working Round the Lack of AutoPostBack

·          Replacing the TreeView Control

·          The ASP.NET Xml Web Forms Control

·          Populating the Xml Controls

·          The XML Documents and the XSLT Stylesheet

·          Managing Without the setOptionButtons Function

·          Managing Without the mainWindowPage Function

·          Managing Without a Close Button

·          Summary

11 - The Login and Register Page

·          The Login and Register Page

·          Web Site Users and Identities

·          Authentication

·          Authorization

·          Impersonation

·          Permissions for the Anonymous Accounts

·          ASP.NET Authentication Methods

·          Windows Authentication

·          Setting Up Windows Authentication

·          Passport Authentication

·          Setting Up Passport Authentication

·          Forms Authentication

·          Setting Up Forms-based Authentication

·          Specifying Users and Groups

·          Specifying HTTP Access Types

·          Avoiding Nested ASP.NET Applications

·          Wrox Cars Login and Register Process

·          The Root Folder web.config File

·          The secure Subfolder web.config File

·          Authentication for Cookie-less Clients

·          Custom Authentication and Authorization Techniques

·          The Process Step-By-Step

·          Why Use Anonymous User IDs?

·          Why Use a Combined Login and Register Page?

·          The Login and Register Page

·          The HTML Page Declarations

·          The ASP.NET Validation Controls

·          The "Login" Section of the Page

·          The TextBox Control Attributes

·          The Validation Control Attributes

·          The Password Text Box and Validation Controls

·          Allowing Persistent Authentication

·          The Login Button and Message Label

·          The ValidationSummary Control

·          The "Register" Section of the Page

·          Comparing Control Values

·          Other Regular Expressions

·          The Register Button and Message Label

·          The Client-side Script Functions

·          Disabling the Submit Buttons

·          The ASP.NET Server-side Code

·          The Page_Load Event Handler

·          Displaying the "Register" Section

·          Disabling the Validation Controls

·          Adapting the Page for Cookie-less Clients

·          The DoLogin Event Handler

·          Authenticating an Existing User

·          Encrypting the Password

·          Executing the Stored Procedure

·          Migrating Existing Quotations to the New User ID

·          Redirecting Cookie-less Clients

·          Updating the User ID Cookie

·          The DoRegister Event Handler

·          Validating the User's Values

·          Inserting the New User Details

·          Inserting a New User into the Database

·          Summary

12 - Viewing Quotations and Orders

·          Quotations and Orders

·          Binding List Controls to Related Data

·          Binding to a Single Data Source

·          Binding Nested List Controls

·          An Example of Nested Bound Controls

·          The DataGrid Declaration

·          The Data Sources for the Lists

·          Handling the OnItemDataBound Event

·          Referencing the Nested List Controls

·          Binding the Nested List Controls

·          Setting the Values of Nested List Controls

·          Selecting Based on a SelectedIndex Value

·          Selecting Based on a Value that Appears in the Control

·          Setting the ImageUrl of the Image Control

·          Binding to Hierarchical Data

·          Hierarchical Binding in the My Cars Page

·          Specifying a DataRelation Within a DataSet

·          Extracting the Related Child Rows

·          Building the "My Cars" Page

·          The HTML for the My Cars Page

·          The Name and Address Details, and Log Off Button

·          The Messages Label

·          The Caption for the Quotations Section

·          The List Control for the Quotations Section

·          The HeaderTemplate Section

·          The ItemTemplate Section

·          The Nested Repeater Control for the Optional Extras

·          The Price and Finance Details

·          The "Order now!" Button

·          The FooterTemplate Section

·          The Orders Section

·          The Code for the My Cars Page

·          Generating the DataSet of User Details

·          The Stored Procedures to Extract the Data

·          The GetUserDetailsDS Function

·          Creating the Relationship Between the Tables

·          The Page_Load Event Handler

·          Checking If the User Has Been Authenticated

·          Setting the Webmaster Email Address

·          Displaying the Page Content

·          Displaying Details of the User

·          Displaying Details of the User's Vehicles

·          The ItemDataBound Event Handlers

·          Handling the ItemDataBound Event for the Quotations List

·          Handling the ItemDataBound Event for the Orders List

·          Logging Out of the Application

·          The Log Off Button Code

·          Placing an Order

·          Executing the Stored Procedure

·          Displaying the Results

·          Sending Order Confirmation Email Messages

·          Creating the Confirmation Email Message

·          Listing the Optional Extras

·          Showing the Price and Finance Details

·          Building the Message Body and Sending the Message

·          Summary

 

©2002 APress! and Stonebroom Limited.