Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grouping DataGridview in c# Winforms

Tags:

c#

winforms

Hi I have the following data in datagridview in c# winforms:


Column A | Column B | Column C | Group

 Register 1  |       10,00     |       15,00 | Group 1
 Register 2  |       10,00     |       15,00 | Group 1
 Register 3  |       10,00     |       15,00 | Group 2
 Register 4  |       10,00     |       15,00 | Group 2

I want to get this in the following form:


Column A | Column B | Column C

Group 1
Register 1 | 10,00 | 15,00
Register 2 | 10,00 | 15,00
Group 1
Register 3 | 10,00 | 15,00
Register 4 | 10,00 | 15,00

I dont want to use multiple datagridviews

like image 698
Chinjoo Avatar asked Aug 20 '10 10:08

Chinjoo


1 Answers

The built-in WinForms DGV does not support grouping. Here is an article where someone has added this functionality themselves (note that I have not used this myself and so am not making a recommendation): http://blogs.vbcity.com/hotdog/archive/2008/12/19/9226.aspx

Alternately there are countless third-party DGV controls for sale. Infragistics has an excellent one that I can recommend which does provide grouping: http://www.infragistics.com/dotnet/netadvantage/winforms/wingrid.aspx#Overview

like image 164
Tergiver Avatar answered Oct 12 '22 10:10

Tergiver