We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Child records are not expanded on DataBoundGrid

Hi,

I am using Syncfusion DataBoundGrid.
I am assigning DataSet as datasource, the grouping works for the first time, and I am able to expand parent to see the child records.

But my requirment is that i get new DataSet ( of the same schema as above) every 1 second. And I need to bind that data again to the DataBoundGrid. This time I can see grouping of records, but I can not see the child records when I click on the + sign.

I am using same function to bind data on the dataGrid. here is the function.

private void UpdateGrid(DataSet ds)
{
lock(dsParentChild)
{
dsParentChild = ds;
grdData.DataMember = "ParentTable";
grdData.DataSource = dsParentChild;
grdData.Binder.AddRelation("ParentID");
}
}

My dataset contains Parent Child Relation, and the RelationName is "ParentID", which I am adding to the Binder.

Please let me know where I am going wrong.

Thanks and Regards,
Rahul Srivastava

1 Reply

JS Jeba S Syncfusion Team August 10, 2007 11:28 AM UTC

Hi Rahul,

Thank you for posting query to us.

In GridDataBoundGrid the child lists are not known until the parent node is expanded, and the GridDataBoundGrid does not try to subscribe to these transient child list events to be able to respond to list updating. In the below sample, the childlist.ListChanged event is subscribed to in RowExpanded and unsubscribed to in RowCollapsing. In the event handler, grid.InvokeRequired is used to make sure the subsequent code is being done on the UI thread. This code essentially collapses the parent node and then expands it. It suspends the drawing to avoid the flicker you would normally see if you tried this. It uses a FreezePainting property in a derived GriddataBoundGrid to suspend the drawing because the normal grid.BeginUpdate/EndUpdate does not work in this situation. It also has to slightly delay the expanding of the node to allow the ListChanged event to complete itself before the node is actually re-expanded.

Please refer this sample and let us know if this helps.
http://websamples.syncfusion.com/samples/Grid.Windows/F67216/main.htm

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

Loader.
Live Chat Icon For mobile
Up arrow icon