Grouping Grid Related Table Selected Records

I have a scenario where the grouping grid is bound to a collection which a child collection.

A GridRelationDescriptor is added using the public property of the child collection to create the hierarchy.

The grid builds out correctly, however when I attempt to query the selected records of the grid I can only retrieve the selected rows of the top-level.

The grid is set to have the MultiExtended selection mode as well as the GridSelectionFlags set to None as per some other examples posted.

Below are a list of properties interrogated and the value returned:

grid.Table.SelectedRecords.Count = 1 (Top level selected record, this is correct).

grid.Table.RelatedTables.Count = 1 (There is only 1 sub collection, this is correct).

grid.Table.RelatedTables[0].SelectedRecords.Count = 0 (This is incorrect, several are selected)

grid.Table.RelatedTables[0].Records.Count = 0 (This is definitely incorrect, there are items in the collection which are displayed as rows)

I have seen other samples provided using data sets, however using object entities the same methodologies are not working.

Thanks,
jc

1 Reply

AD Administrator Syncfusion Team November 22, 2006 05:08 AM UTC

Hi Josh,

In a flat groupinggrid, you can get the selected records in this manner.

GridTable gt = this.gridGroupingControl1.Table;
foreach(SelectedRecord rec in gt.SelectedRecords)
{
Console.WriteLine(rec.Record);
}

With the nested tables, you need to get the child table you want, and do the same type of thing. Here is a code snippet

GridTable gt = this.gridGroupingControl1.GetTable("ChildTable");
foreach(SelectedRecord rec in gt.SelectedRecords)
{
Console.WriteLine(rec.Record);
}

Please refer to the attached sample for getting selected record in a grid.
http://www.syncfusion.com/Support/user/uploads/GGC_HideTable_4d9308b7.zip

Best Regards,
Haneef

Loader.
Up arrow icon