简体   繁体   English

使用C#对DataGridView进行分组

[英]Grouping DataGridView using C#

Can anyone explain to me how to make grouping for the DataGridView in C# because I have no idea about this topic? 谁能给我解释一下如何对C#中的DataGridView进行分组,因为我对此主题一无所知?

I searched on the websites but I didn't understand anything. 我在这些网站上搜索,但一无所知。

Also I found somethings about GridViewHelper but I didn't know how to deal with it because it gives me this error (The type or namespace name 'GridViewHelper' could not be found (are you missing a using directive or an assembly reference 我也发现了一些有关GridViewHelper的信息,但是我不知道如何处理它,因为它给了我这个错误(找不到类型或名称空间名称'GridViewHelper'(您是否缺少using指令或程序集引用?

Note: I am using Windows Forms C# 注意:我正在使用Windows Forms C#

This is my datagridview 这是我的datagridview

I want to make it exactly like this one according to name column 我想按照名称列使其完全像这样

You need at first two different tables, using a common field to link them (like the Serial Number, for instance). 您首先需要两个不同的表,并使用一个公共字段将它们链接起来(例如,序列号)。

But the built-in DataGridView of VS does not support that kind of display. 但是VS的内置DataGridView不支持这种显示。 You will achieve it only with custom or third-party controls. 您只能使用自定义控件或第三方控件来实现它。

See here to more info: 看到这里更多信息:

http://10tec.com/articles/datagridview-grouping-two-recipes.aspx http://www.infragistics.com/products/windows-forms/grid#Overview http://10tec.com/articles/datagridview-grouping-two-recipes.aspx http://www.infragistics.com/products/windows-forms/grid#Overview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM