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.
Unfortunately, activation email could not send to your email. Please try again.

programaticly select a group row

Thread ID:

Created:

Updated:

Platform:

Replies:

58319 Mar 22,2007 01:10 AM Mar 22,2007 10:45 AM Windows Forms 1
loading
Tags: GridControl
shachar
Asked On March 22, 2007 01:10 AM

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

Administrator [Syncfusion]
Replied On March 22, 2007 10:45 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;