datagrid complex object binding
-
its alitle hard to explane what i wont.. but i will try any way. lets say i got 2 classes: public class person { private string firstname; private string lastname; private ArrayList exames; // (or HashTable) contaning Exame objects public string FirstName { get{return firstname;} set{firstname = value;} } public string LastName { get{return lastname;} set{lastname = value;} } public ArrayList Exames { get(return exames;} set{exames = value;} } } public Class Exame { private string examename; private int grade; public string ExameName { get{return examename;} set(examename = value;} } public int Grade { get{return grade;} set{grade = value;} } } so far so good.. but now i want to bind the person object to a datagrid. and i want the datagrid to show the next information: person mike = new person(); mike.FirstName = "mike"; mike.LastName = "james; mike.Exames.Add(new Exame()); ((Exame)mike.Exames[0]).ExameName = "english"; ((Exame)mike.Exames[0]).Grade = 100; mike.Exames.Add(new Exame()); ((Exame)mike.Exames[1]).ExameName = "math"; ((Exame)mike.Exames[1]).Grade = 90; in the next way in the grid: FirstName LastName english math (thouse are the column names) "mike" "james" 100 90 (the data itself) (P.S ignore the problem when a persion doesnt have a serten exame.. and all other small error's i know how to overcome them. i just need to know how to show it like this)