set a grouped row in ggc

hi all.
in my ggc i have some rows, grouped by one column.
when the user clicks on a button i want to expand a specific group (e.g - the parentgroup.category=5)
and set its first row to be selected.
can you give me a small example for this?

2 Replies

AD Administrator Syncfusion Team March 21, 2007 02:55 PM UTC

Hi Shachar,

Try handling the GroupExpanded event of the grid and call the SetSelected method to select the first child records in a group. Here is a code snippet.

private void gridGroupingControl1_GroupExpanded(object sender, GroupEventArgs e)
{
if( e.Group != null && e.Group.Records.Count > 0)
{
e.Group.Records[0].SetSelected(true);
e.Group.Records[0].SetCurrent(e.Group.Name);
}
}

Best regards,
Haneef


SS Shachar Shimshon March 21, 2007 04:59 PM UTC

but i want my user to expand the group.
how can it happen with the event?
my user would like to expans a ceratin group that he knows it's category, so how can he do it?

>Hi Shachar,

Try handling the GroupExpanded event of the grid and call the SetSelected method to select the first child records in a group. Here is a code snippet.

private void gridGroupingControl1_GroupExpanded(object sender, GroupEventArgs e)
{
if( e.Group != null && e.Group.Records.Count > 0)
{
e.Group.Records[0].SetSelected(true);
e.Group.Records[0].SetCurrent(e.Group.Name);
}
}

Best regards,
Haneef

Loader.
Up arrow icon