Including Subheadings in a Datagrid

July 25, 2003

[From ASP.NET.4GuysFromRolla.com]

I short while ago I was tasked with adding subheadings into a datagrid, something I have not tried to do, or even thought of doing prior to this assignment. Thus, the task was a little bit beyond my skillset. Having searched around the net for examples, I came up dry. I eventually solved this problem, so I thought I'd share with you how I accomplished adding subheadings to a DataGrid.

First, let me define what I mean by subheadings. Oftentimes, the data displayed in a DataGrid can be logically grouped in some manner. For example, in Scott Mitchell's An Extensive Examination of the DataGrid Web Control, Scott displays the FAQs from the ASPFAQs.com database. Each of these FAQs belongs to precisely one FAQ category. In the Northwinds database's Products table, each product belongs to precisely one product category. In both of these examples, we can improve the DataGrid UI by showing how these FAQs or products are grouped by category.

The article continues at http://aspnet.4guysfromrolla.com/articles/072603-1.aspx