deisler
February 7th, 2009, 06:36 AM
I have a generic list List<Order>, in which Order object has some common property such as OrderId,TotalValue and property that map to another object, called Customer{CustomerId, CustomerName}. Snippet of code for clarification :
class Order
{
string OrderId; // Property
double TotalValue; // Propery
Customer CustomerOnSign; // Property
}
class Customer
{
string CustomerId; //Property
string CustomerName; //Property
}
Now I want to populate List<Order> to DataGridView.Datasource and when I try to render Customer column, I set the column's DataPropertyName = "CustomerOnSign.CustomerName" it seems to appear nothing in the grid. If I set the DataPropertyName = "CustomerOnSign", it only appears the Customer object name but not the CustomerName property, which I want.
Just want to know is there any way to overcome this prob ? Any help is highly appreciated.
class Order
{
string OrderId; // Property
double TotalValue; // Propery
Customer CustomerOnSign; // Property
}
class Customer
{
string CustomerId; //Property
string CustomerName; //Property
}
Now I want to populate List<Order> to DataGridView.Datasource and when I try to render Customer column, I set the column's DataPropertyName = "CustomerOnSign.CustomerName" it seems to appear nothing in the grid. If I set the DataPropertyName = "CustomerOnSign", it only appears the Customer object name but not the CustomerName property, which I want.
Just want to know is there any way to overcome this prob ? Any help is highly appreciated.