Well, I sort of resolved the issue of dynamically populating child table and it works if I have parent/child relation keys defined appropriately. However, I've a requirement where both the tables should display data independently without any relationship. So, I tried this:
GridRelationDescriptor childRelationDescriptor = new GridRelationDescriptor(CHILD_RELATION_DESCRIPTOR);
childRelationDescriptor.ChildTableName = CHILD_TABLE_NAME;
childRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
// it could be valid column names from parent/child tables
childRelationDescriptor.RelationKeys.Add("ID", "ID");
.TableDescriptor.Relations.Add(childRelationDescriptor);
//pre-populate empty child table
GridGroupingControl.Engine.SourceListSet.Add(CHILD_TABLE_NAME, GetChildDataCollection());
I've configured "OnRecordExpanded" event to expand data and populate child table with this code:
GridGroupingControl.Engine.SourceListSet.Add(CHILD_TABLE_NAME, RePopulateChildDataCollection());
GridGroupingControl.TableDescriptor.EnableOneTimePopulate();
With the above code, data are displayed appropriately on the grid whenever the row gets expanded for the first time. However, whenever I tried to expand another row keeping the old one expanded, the page post-back event occurs and that basically resets the grid-view with all rows collapsed.
The grid works fine if I use valid RelationKeys from parent and child tables.
Any thoughts or suggestions?