Hi David,
Thanks for your interest in Syncfusion Products.
I was able to see the issue while copying a range of cells and pasting at the bottom of grid. It occurs when the pasting range is less than the copied range in grid. It is the default behavior in bounded grids. If you would like to avoid this exception, you can handle some condition check in ClipboardPaste event and paste accordingly.
Please refer to the following code handled in ClipboardPaste event.
void Model_ClipboardPaste(object sender, GridCutPasteEventArgs e)
{
int top1 = -1;
int left1 = -1;
int bottom1 = -1;
int right1 = -1;
foreach (GridRangeInfo range in e.RangeList)
{
top1 = range.Top;
left1 = range.Left;
bottom1 = range.Bottom;
right1 = range.Right;
break;
}
int row = bottom1 - top1 + 1;
int col = right1 - left1 + 1;
int row1 = this.gridDataBoundGrid1.Model.RowCount - this.gridDataBoundGrid1.CurrentCell.RowIndex;
int col1 = this.gridDataBoundGrid1.Model.ColCount - this.gridDataBoundGrid1.CurrentCell.ColIndex;
GridRangeInfoList list1 = new GridRangeInfoList();
if (row > row1)
{
while (row > row1 + 1)
{
bottom1 -= 1;
list1.Clear();
list1.Add(GridRangeInfo.Cells(top1, left1, bottom1, right1));
e.RangeList = list1;
row -= 1;
}
if (col > col1)
{
while (col > col1 + 1)
{
right1 -= 1;
list1.Clear();
list1.Add(GridRangeInfo.Cells(top1, left1, bottom1, right1));
e.RangeList = list1;
col -= 1;
}
}
GridData setdata = null;
int rowCount = 0;
int colCount = 0;
this.gridDataBoundGrid1.Model.DataExchange.CopyCellsToDataObject(out setdata, e.RangeList, true, GridDragDropFlags.Styles, out rowCount, out colCount);
DataObject data = new DataObject(setdata);
Clipboard.SetDataObject(data);
}
}
This checks for the range of pasting range and copied range. If the paste range is less than the copied range, it cancels the pasting. Else, it copies as normal. This avoid throwing exception.
Sample:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F89740.zipRegards,
Rajadurai