Enhancing the DataGrid with Grouped Rows and Subheadings
page 1 of 4
Published: 21 Sep 2005
Unedited - Community Contributed
The ASP.NET DataGrid control provides no methods by which to group related items. Michelle Beall presents three simple techniques to enhance a DataGrid by grouping related rows and adding subheadings.
by Michelle Beall
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38655/ 35


Often the need arises to be able to group data in a DataGrid under subheadings. I will discuss and demonstrate three methods wth which to achieve grouping and subheadings in a DataGrid.

  1. After the DataGrid has been populated, the column with the group names is updated so that each group name spans all corresponding rows.
  2. Before the DataGrid has been populated, the data source is manipulated to add extra rows to act as subheadings.
  3. While the DataGrid is being populated, an extra subheading row is added each time the value of the group name column changes.

With the first option, the resulting table would resemble the following:

With the second and third options, the resulting table would resemble the following:

View Entire Article

User Comments

No comments posted yet.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-17 6:57:11 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search