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

Selection -> Rows

Can you please provide a simple code example on how to find the rows in the underlying data table that corresponds to the current selection in the grouping grid? (If the selection is a block of cell, I want all rows intersecting this block.) I find it a bit difficult to figure out this from the doc. I am using TableOptions.AllowSelection = GridSelectionFlags.Any; TableOptions.ListBoxSelectionMode = SelectionMode.None; Thanks.

3 Replies

AD Administrator Syncfusion Team June 23, 2005 04:49 PM UTC

This worked for me using a flat table.
private void button1_Click(object sender, System.EventArgs e)
{
	GridTableControl tc = this.gridGroupingControl1.TableControl;
	foreach(GridRangeInfo range in tc.Selections.Ranges)
	{
		GridRangeInfo range1 = range.ExpandRange(1, 1, tc.Model.RowCount, tc.Model.ColCount);
		for(int row = range1.Top; row <= range1.Bottom; ++row)
		{
			GridTableCellStyleInfo style = tc.Model[row, range1.Left];
			if(style.TableCellIdentity.DisplayElement != null 
				&& style.TableCellIdentity.DisplayElement.ParentRecord != null)
			{
				DataRowView drv = style.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView;
				if(drv != null)
				{
					Console.WriteLine("{0}  {1}  {2}  {3}", drv[0], drv[1], drv[2], drv[3]);
				}
			}
		}
	}
}


AD Administrator Syncfusion Team June 24, 2005 03:47 PM UTC

Just what I was looking for. Thanks a lot! One more question: If I have got a TableDescriptor from the grid (may be the TableDescriptor for a foreign key table), how do I found the underlying ADO DataTable?


AD Administrator Syncfusion Team June 24, 2005 04:44 PM UTC

Try TableDescriptor.Name.

Loader.
Live Chat Icon For mobile
Up arrow icon