Here I have these Classes:
public class CustomerDebt
{
public int ID { get; set; }
public string Name { get; set; }
public string Family { get; set; }
public string Remain { get; set; }
public List<Shops> details = new List<Shops>();
}
public class Shops
{
public List<int> ints = new List<int>();
public List<string> strings = new List<string>();
}
I'm making a list of CustomerDebts objects:
List<CustomerDebt> debts = new List<CustomerDebt>();
and Here I will add one item to it:
Shops shop = new Shops();
shop.ints.Add(1);
shop.ints.Add(2);
shop.strings.Add("M");
shop.strings.Add("S");
shop.strings.Add("F");
CustomerDebt d = new CustomerDebt();
d.ID = 12;
d.Name = "Joe";
d.Family = "Steven";
d.Remain = "1000";
d.details.Add(shop);
debts.Add(d);
Now I bind debts list into a grid view:
gridview.DataSource = debts;
It will automatically fill the grid view with only "ID,Name,Family,Remain" properties of CustomerDebt Class. But I need to bind the List property which is a list of another Class into grid view.
I think it needs something like {get; set;} to be shown in grid, But also I do not know If the grid can show a nested class like this.
Hope I'm clear. What should I do to get a clean Grid view with such list of Class objects?