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.

Move items between 2 GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

6637 Aug 20,2003 05:18 PM Aug 20,2003 06:02 PM Windows Forms 1
loading
Tags: GridControl
Charlies Chan
Asked On August 20, 2003 05:18 PM

In my application, we implemented two GridDataBoundGrid that are tied to a datasource. We need to be able to move items between the 2 grids. I have looked at various methods, but is unable to figure out how to: a. Get the current selected rows? (might not be contiguous) I tried datagrid.Selections.GetSelectedRows(true, false); datagrid.Selections.GetSelectedRows(true, false).ActiveRange; b. How to map the "selected row to the row in the datasource"? I am trying to use datagrid.DataSource.Remove() or datagrid.DataSource.RemoveAt() Can any one provide me with an example? This sounds like a very easy thing to do, but I am new to the Syncfusion framework. Thanks you for your help!

Administrator [Syncfusion]
Replied On August 20, 2003 06:02 PM

Here is code that loops through all the selected rows.
private void button1_Click(object sender, EventArgs e)
{			
	int totalRows = 0;
	string printRows = "rows: ";
	foreach(GridRangeInfo range in this.gridControl1.Selections.GetSelectedRows(true,false))
	{
		totalRows += range.Bottom - range.Top + 1;			
		for(int i = range.Top; i <= range.Bottom; i++)
		{
			printRows += i.ToString()+"  ";
		}
	}
	MessageBox.Show(string.Format("Total Rows: {0}  Rows: {1}", totalRows, printRows));
}
To delete a record at a rowindex in the grid, you can use: gridDataBoundGrid1.DeleteRecordsAtRowIndex Or, you can also use gridDataBoundGrid1.Binder.RemoveRecords. But to use this, you need to use gridDataBoundGrid1.Binder.RowIndexToPosition to convert the rowindex to a record position.

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.

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.

;