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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using GridGroupingControl as a listbox etc.

Thread ID:

Created:

Updated:

Platform:

Replies:

19860 Oct 5,2004 02:43 PM UTC Oct 5,2004 03:34 PM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 5, 2004 02:43 PM UTC

Hi, I would like to use two GridGroupingControls... one as a listbox, the second to contain the selected values. I do have the listbox grid selection mode working fine. My issue is with getting the selected values from the listbox grid into the selected values grid. The best way to accomplish this and meet my other requirements would be to copy the selected rows from the underlying DataTable in the listbox grid to the underlying DataTable in the selected values grid. I have found gridGroupingControl1.TableControl.Selections but I only see access to GridRangeInfo objects and not the selected rows. Do you have any examples of how to do this? Thanks in advance, Brian

Administrator [Syncfusion]
Replied On October 5, 2004 03:34 PM UTC

Here is button handler that will create an arraylist of DataRowView objects from the selected rows.
private void button1_Click(object sender, System.EventArgs e)
{
	ArrayList drvs = new ArrayList();
	foreach(GridRangeInfo range in this.gridGroupingControl1.TableControl.Selections.Ranges)
	{
		if(range.IsRows)
		{
			for(int i = range.Top; i <= range.Bottom; ++i)
			{
				GridRecordRow rec = this.gridGroupingControl1.Table.DisplayElements[i]  as GridRecordRow;
				if(rec != null)
				 	drvs.Add(rec.GetData());
			}
		}
	}
	//now drvs should hold the select DataRowView objects
	foreach(DataRowView drv in drvs)
		Console.WriteLine(drv["Col1"]);
	}
}

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.

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

;