Binding DataGridView from List Task
I have a list of clients that I am trying to bind to a DataGridView. I have two data classes that look like this:
public class Customer
{
public string Name { get; set; }
public AddressDetail Address { get; set; }
}
public class AddressDetail
{
public string StreetAddress { get; set; }
public string City { get; set; }
}
Then when I try to populate the DataGridView I use:
CustomerInfo custInfo = new CustomerInfo();
CustomerGrid.DataSource = custInfo.GetCustomers();
GetCustomers will return a list of customers. My problem is that the address column is only one column and it shows "Address" in the column. What is the best way to display columns for all members of the Address class in the DataGridView.
+1
a source to share