Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
680
force grid rebind to objects
posted

I have a grid bound to a collection of objects each object has a collection of child objects and they all display nicely e.g.

 

object 1

child 1

child 2

object 2

child 1

 

Now in code I add a child to object 2 e.g. MyObject2.Add(child) i then can view the collection at runtime e.g.

((List<MyObject>)myGrid.DataSource)

And this shows that the child has been added succesfully, however if i call myGrid.DataBind() the new child does not appear in the child band in the grid.

How do I get it to appear automatically ??

If I do the following I lose my current layout and positioning but the child is there:

var data = ((List<MyObject>)myGrid.DataSource);

myGrid.DataSource = null;

myGrid.DataSource = data;