How to Access the Group from DisplayElements

3 Jan 20201 minute to read

To access the group from DisplayElements, use the following code snippet.

//For all the display elements in the Table.
foreach(Element el in gridGroupingControl1.Table.DisplayElements)
{
//DisplayElementKind.Record or DisplayElementKind.Summary.
    if(el.Kind==DisplayElementKind.Record || DisplayElementKind.Summary)
    {
        Group g = el.ParentGroup;
        System.Diagnostics.Trace.WriteLine(g.Info);
    }
}
'For all the display elements in the Table
For Each el As Element In gridGroupingControl1.Table.DisplayElements

'DisplayElementKind.Record or DisplayElementKind.Summary
If el.Kind=DisplayElementKind.Record OrElse el.Kind=DisplayElementKind.Summary Then
Dim g As Group = el.ParentGroup
System.Diagnostics.Trace.WriteLine(g.Info)
End If
Next el