ASP.NET “Mini” Master/Detail Pattern
In ASP.NET 2.0 the master/detail pattern has undergone massive improvements, however when working with ASP.NET 1.1 and Visual Studio .NET 2003/2002 it is a much more manual process. There are hundreds of articles regarding this subject however the most common usage is with large amounts of data; meaning long lists, with subsets of data that can fill large forms.
Sometimes the amount of data is smaller and you need to develop a much more compact version of this pattern, providing your users with a quick and easy lookup for extra information regarding your entity, whatever it may be.
In this tutorial we’ll look at a compact or “mini” version of the master/detail pattern which uses a very small list of data presented in a DataGrid component, and selecting a row in the DataGrid will display a minimal amount of extra information on another details form contained in the same page.
In addition to the master/detail pattern we’ll also implement a few tips & tricks with the DataGrid component to give us a more usable control. Below is a list of other aspects covered in this tutorial:
- Bound column concatenation: Binding more than one column in the data source to a
single column on the DataGrid component without using code-behind
- Primary Key lookup: Binding the primary key to a hidden field on the DataGrid for easy seeking of rows on selection
- Select anywhere feature: Allowing the user to click on any cell on the DataGrid to invoke the SelectedIndexChanged event
- Manual DataSet object construction: How to create a DataSet through code including a primary key column
- Enable smart navigation to minimize page refresh visually
Although this tutorial is designed to be used in a more compact fashion the pattern itself can easily be migrated to larger implementations with larger volumes of data. This tutorial is not based on the new ASP.NET 2.0 implementation wizards for building master/detail pages; it is designed for ASP.NET 1.1.
Note: Visual Studio .NET running ASP.NET 1.1 is required for this tutorial. Both VB.NET and C# code samples will be provided