How do I display the master-detail view in 2 grids instead of one grid. Here's how I populate the grid currently and it does show master-detail view.
I don't know how to set the relation or DataMember property (as shown in some examples that use database) in case of using 2 grid controls to create a relation with the current data structure.
public class Master
{
public int id { get; set; }
public List<Sub> subs { get; set; }
}
public class Sub
{
public int id { get; set; }
public string name { get; set; }
}
//filling some data for master and sub objects
private void FillData()
{
master = new List<Master>();
for (int i = 0; i < 10; i++)
{
Master tmpmaster = new Master();
tmpmaster.id = i;
tmpmaster.name = "Master " + (i + 1).ToString();
tmpmaster.subs = new List<Sub>();
for(int j = 0; j < 5; j++)
{
Sub tmpsub = new Sub();
tmpsub.id = j;
tmpsub.name = "Sub " + (j + 1).ToString();
tmpmaster.subs.Add(tmpsub);
}
master.Add(tmpmaster);
}
}
FillData();
grid = new GridControl();
this.Controls.Add(grid);
grid.DataSource = master;
Thanks for any suggestions.