Home Forums WinForms controls Xceed Grid for WinForms GetSortedDataRows Reply To: GetSortedDataRows

User (Old forums)
Member
Post count: 23064

This is normal since this event is triggered right after the group is created, before it is filled with DataRows.  In fact, if you inspect the EventArgs, you will see that one member is the DataRow that is responsible for creating the group, which can happen only once.  All other DataRows added to this group will not trigger this event.

You need to use the GroupingUpdated event so that all groups have been completely built before you try to access their DataRowList.

e.g.:

private void Form1_Load( object sender, EventArgs e )

{

    gridControl1.GroupingUpdated +=

new EventHandler( gridControl1_GroupingUpdated );

}

void gridControl1_GroupingUpdated( object sender, EventArgs e )

{

    foreach( Group group in gridControl1.Groups )

    {

        //Note that groups can contain groups, so you may need to loop on group.Groups also.

        Debug.WriteLine( group.Title + ” “ + group.GetSortedDataRows( false ).Count.ToString() );

    }

}

 

Imported from legacy forums. Posted by André (had 326 views)