We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

programaticly select a group row

hi all.
how can i programaticly select the group row
(not the records inside the group, but the grouping row itself)

1 Reply

AD Administrator Syncfusion Team March 22, 2007 02:45 PM UTC

Hi Shachar,

You should set the TableOptions.AllowSelection property to GridSelectionFlags.Any; to turn ON cell based selection mechanism in a grid and use TableModel.Selections property to manage the selection in a grid by handling the GroupExpanded event. Please find the code snippet below.

//Form load...
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.None;
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;

this.gridGroupingControl1.GroupExpanded +=new GroupEventHandler(gridGroupingControl1_GroupExpanded);

private void gridGroupingControl1_GroupExpanded(object sender, GroupEventArgs e)
{
if( e.Group != null && e.Group.Records.Count > 0)
{
GridGroupingControl grid = sender as GridGroupingControl;
DisplayElementsInTableCollection elements = e.Group.ParentChildTable.DisplayElements;

int Startindex = elements.IndexOf(e.Group);
int Endindex = elements.IndexOf(e.Group.Records[e.Group.Records.Count -1] );

grid.TableModel.Selections.Clear(false);
grid.TableModel.Selections.Add(GridRangeInfo.Rows(Startindex, Endindex));
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon