Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

DataGridView cell with List as value

$
0
0

Hello everyone,

I was wondering how can I display something like this in DataGridView (Windows Forms):

public class UserDetails
{
    private string _securityId;
    private string _firstName;
    private string _lastName;
    private string _email;
    private List<GroupDetails> _groups;
    ...
}

The GroupDetails class has property called "GroupName". Is it possible to display _groups property values in ComboBox cell containing GroupName as DisplayMember for each row in DataGridView.

For example in #1 row user has 2 values in _groups: "Group A" and "Group B", in #2 row another user has 3 values in "Group A", "Group C" and "Group X".

When I bind ComboBox column values to DataMember corresponding _groups property each row has the same values in that column. The easiest workaround is to display values in multiline TextBox column or comma separated values in single row but ComboBox looks better.


Viewing all articles
Browse latest Browse all 31927

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>