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.

Selection -> Rows

Thread ID:





30778 Jun 23,2005 10:55 AM Jun 24,2005 12:44 PM Windows Forms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On June 23, 2005 10:55 AM

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 12:49 PM

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 11:47 AM

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 12:44 PM

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.

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.