GDBD Cut/Copy restriction

I have a row selected in the GDBD and the grid''s ActivateCurrentCellBehavior is set to GridCellActivateAction.SelectAll. I only want the current cell contents to copied or pasted. Thanks, Sri

3 Replies

AD Administrator Syncfusion Team November 1, 2005 03:41 PM UTC

Try handling the grid.Model.ClipboardCopy event and in your handler, put teh currentcell text onto the clipboard.
private void Model_ClipboardCopy(object sender, GridCutPasteEventArgs e)
{
	Clipboard.SetDataObject(this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText);
	e.Handled = true;
	e.Result = true;
}


AD Administrator Syncfusion Team November 1, 2005 03:59 PM UTC

Clay, Thanks a lot for the help. Your suggestion worked but only for copy. when i use ctrl+x to cut it just copied but did not clear the contents of the cell. Do we need to do this manually? I hooked both Model_ClipboardCopy and Model_ClipboardCut to the handler you suggested. Thanks, Sri >Try handling the grid.Model.ClipboardCopy event and in your handler, put teh currentcell text onto the clipboard. >
>private void Model_ClipboardCopy(object sender, GridCutPasteEventArgs e)
>{
>	Clipboard.SetDataObject(this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText);
>	e.Handled = true;
>	e.Result = true;
>}
>


AD Administrator Syncfusion Team November 1, 2005 04:16 PM UTC

Try this handler for cut.
private void Model_ClipboardCut(object sender, GridCutPasteEventArgs e)
{
	Clipboard.SetDataObject(this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText);
	e.Handled = true;
	e.Result = true;
	this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText = "";
}

Loader.
Up arrow icon