SR
Sri Rajan
Syncfusion Team
May 26, 2008 02:19 PM UTC
Hi Vikas,
Thank you for your patience.
To get the selected rows in a GridControl, you need to use Selections.GetSelectedRanges method. To copy the selected rows in one grid control and pasted it in another grid control, you need to use Model.CutPaste.Copy() and Model.CutPaste.Paste() methods. Please refer the below code for more details.
private void buttonAdv1_Click(object sender, EventArgs e)
{
//To Get the Selected Ranges.
GridRangeInfoList ranges;
this.gridControl1.Model.Selections.GetSelectedRanges(out ranges, true);
foreach (GridRangeInfo sel in ranges)
{
Console.WriteLine("First Row : " + sel.Top.ToString());
}
//To copy range of row from one grid to another.
this.gridControl1.Model.CutPaste.Copy();
this.gridControl2.Focus();
this.gridControl2.CurrentCell.MoveTo(1, 1);
this.gridControl2.Model.CutPaste.Paste();
this.gridControl2.Model.Refresh();
}
Best Regards,
Srirajan