how to Stop/Cancel Paste operation

Hi there,

im using Grid Data Bound Grid and explicitly call the grid.Model.CutPaste.Paste()
and then im doing the validation of value pasted in the
Model.DataProviderSaveCellInfo event..

how do i stop the paste operation from the DataProviderSaveCellInfo whenever my custom validation is failing..

thanks


1 Reply

YV Yuvaraja V Syncfusion Team November 2, 2010 01:42 PM UTC

Hi,

Thank you for your interest in Syncfusion products.

In DataBoundDataGrid, We Can Cancel the paste option by using Result property with the following code,

void Model_ClipboardCanPaste(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e)
{
GridCurrentCell cc1 = this.gridDataBoundGrid1.CurrentCell;

if (cc1.Renderer.ControlText.Length>4)
{

e.Handled = true;
e.Result = true;

//Set Result Property to False to disable the process.

}
else if (cc1.Renderer.ControlText.Length>=3)
{
e.Handled = true;
e.Result = false;
}
}

private void Paste_Click(object sender, EventArgs e)
{
this.gridDataBoundGrid1.Model.CutPaste.Paste();
}

here is the link for the sample

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=PasteSample-1054322200.zip


Loader.
Up arrow icon