1
votes

I need some help here. Here is my situation:

I have a binding list which contains another binding list which I use as data source. below is an example:

Objects:

public class test
{
        public string name { get; set; }
        public BindingList<childs> childlist { get; set; }
}
public class childs
{
        public string childname { get; set; }
}

I populate my radgrid by code. below is a preview:

private void form_Load(object sender, EventArgs e)
 {
            BindingList<test> testlist = new BindingList<test>();

            /** I populate my list with data. I wont show this here. After the list is populated: **//

            this.raggrid.MasterTemplate.Columns.Clear();
            this.raggrid.MasterTemplate.AutoGenerateColumns = true;
            this.raggrid.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            this.raggrid.MasterTemplate.Columns.Add(new GridViewTextBoxColumn("name", "name"));

            GridViewTemplate template = new GridViewTemplate();
            this.raggrid.Templates.Add(template);
            template.Columns.Add(new GridViewTextBoxColumn("name", "childname"));
            template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            GridViewRelation relation = new GridViewRelation(this.raggrid.MasterTemplate, template);
            relation.ChildColumnNames.Add("childlist");
            this.raggrid.Relations.Add(relation);
            this.raggrid.DataSource = testlist;
}

The populating step works fine. But now, when the user edits the detail grid(named template from the code), I must update the binding list accordingly (named testlist from the code). I cannot seem to trigger an event when I edit the child grid. How do I achieve this?

Note: This is a winform application

PS: When I update the master template the binding list gets updated automatically as expected, but when I update the template I use as detail, it does not update the biding list.

Thanks,

Yash

1

1 Answers

2
votes

For anyone having a similar problem, here is the solution:

Solution

Only thing is that I used CellValueChanged event instead of RowsChanged.