Building and using a 3-tiered data architecture with ASP.NET 2.0
Welcome to a series of tutorials that will explore techniques for implementing these common data access patterns in ASP.NET 2.0. These tutorials are geared to be concise and provide step-by-step instructions with plenty of screen shots to walk you through the process visually. Each tutorial is available in C# and Visual Basic versions and includes a download of the complete code used.
Introduction | Basic Reporting | Master/Detail | Custom Formatting
Introduction
Creating a Data Access Layer
![]() | In this tutorial we'll start from the very beginning and create the Data Access Layer (DAL), using typed DataSets, to access the information in a database. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Creating a Business Logic Layer
![]() | In this tutorial we'll see how to centralize your business rules into a Business Logic Layer (BLL) that serves as an intermediary for data exchange between the presentation layer and the DAL. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Master Pages and Site Navigation
![]() | One common characteristic of user-friendly websites is that they have a consistent, site-wide page layout and navigation scheme. This tutorial looks at how you can create a consistent look and feel across all pages that can easily be updated. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Basic Reporting
Displaying Data With the ObjectDataSource
![]() | This tutorial looks at the ObjectDataSource control Using this control you can bind data retrieved from the BLL created in the previous tutorial without having to write a line of code! View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Declarative Parameters
![]() | In this tutorial we'll illustrate how to use a parameter set to a hard-coded value to select the data to display in a DetailsView control. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Programmatically Setting the ObjectDataSource's Parameter Values
![]() | In this tutorial we'll look at adding a method to our DAL and BLL that accepts a single input parameter and returns data. The example will set this parameter programmatically. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Master/Detail Reporting
Master/Detail Filtering With a DropDownList
![]() | In this tutorial we'll see how to display the master records in a DropDownList control and the details of the selected list item in a GridView. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Master/Detail Filtering With Two DropDownLists
![]() | This tutorial expands the master/detail relationship to add a third layer, using two DropDownList controls to select the desired parent and grandparent records. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Master/Detail Filtering Across Two Pages
![]() | In this tutorial we'll implement this pattern by using a GridView to list the suppliers in the database. Each supplier row in the GridView will contain a View Products link that, when clicked, will take the user to a separate page that lists those products for the selected supplier. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Master/Detail Using a Selectable Master GridView with a Details DetailView
![]() | This tutorial will have a GridView whose rows include the name and price of each product along with a Select button. Clicking the Select button for a particular product will cause its full details to be displayed in a DetailsView control on the same page. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Custom Formatting
Custom Formatting Based Upon Data
![]() | Adjusting the format of the GridView, DetailsView, or FormView based upon the data bound to it can be accomplished in multiple ways. In this tutorial we'll look at how to accomplish data bound formatting through the use of the DataBound and RowDataBound event handlers. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Using TemplateFields in the GridView Control
![]() | To provide flexibility, the GridView offers the TemplateField, which renders using a template. A template can include a mix of static HTML, Web controls, and databinding syntax. In this tutorial we'll examine how to use the TemplateField to achieve a greater degree of customization with the GridView control. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Using TemplateFields in the DetailsView Control
![]() | The same TemplateFields capabilities available with the GridView are also available with the DetailsView control. In this tutorial we'll display one product at a time using a DetailsView containing TemplateFields. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Using the FormView's Templates
![]() | Unlike the DetailsView, the FormView is not composed of fields. Instead, the FormView is rendered using templates. In this tutorial we'll examine using the FormView control to present a less rigid display of data. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |
Displaying Summary Information in the GridView's Footer
![]() | Summary information is often displayed at the bottom of the report in a summary row. The GridView control can include a footer row into whose cells we can programmatically inject aggregate data. In this tutorial we'll see how to display aggregate data in this footer row. View this tutorial: Visual Basic | Visual C# Download the code: Visual Basic | Visual C# |