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

Getting selected records in a GroupingGrid with NestedTables

Hi, How can I get the selected records(rows) in a grouping grid with a NestedTable? How can I get any selected records? thanks, -beau

1 Reply

AD Administrator Syncfusion Team March 6, 2004 08:10 AM

In a flat groupinggrid, you can get the selections in this manner.
private void button2_Click(object sender, System.EventArgs e) 
{ 
	GridRangeInfoList rangeList = this.gridGroupingControl1.TableControl.Selections.GetSelectedRows(true, false); 
	if(rangeList.Count > 0) 
	{ 
		foreach(GridRangeInfo range in rangeList) 
		{ 
			for(int row = range.Top; row <= range.Bottom; ++row) 
			{ 
				Console.WriteLine(this.gridGroupingControl1.Table.DisplayElements[row].ToString()); 
			} 
		} 
	} 
} 
With the nested tables, you need to get the child tablecontrol you want, and do the same type of thing. But there is a problem that there is only one Selection collection for each child level, and this will cause selections in one child to be seen in other children as the same level.
private void button2_Click(object sender, System.EventArgs e) 
{ 
	GridTableControl gtc = this.gridGroupingControl1.GetTableControl("ChildTable"); 
	GridRangeInfoList rangeList = gtc.Selections.GetSelectedRows(true, false); 
	if(rangeList.Count > 0) 
	{ 
		foreach(GridRangeInfo range in rangeList) 
		{ 
			for(int row = range.Top; row <= range.Bottom; ++row) 
			{ 
				Console.WriteLine(gtc.Table.DisplayElements[row].ToString()); 
			} 
		} 
	} 
} 

Loader.
Live Chat Icon For mobile
Up arrow icon