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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Selection -> Rows

Thread ID:





30778 Jun 23,2005 02:55 PM UTC Jun 24,2005 04:44 PM UTC WinForms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On June 23, 2005 02:55 PM UTC

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.

Administrator [Syncfusion]
Replied On 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]);

Administrator [Syncfusion]
Replied On 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?

Administrator [Syncfusion]
Replied On June 24, 2005 04:44 PM UTC

Try TableDescriptor.Name.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon