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. Image for the cookie policy date
close icon

Ctrl+C

Hi, I am using GDBG v3.2.1 with ListBoxSelectionMode set to ONE. I am trying to copy the content of a cell, but I am always getting the complete row in the clipboard. How can I set the grid that the content of the selected cell is copied to the clipboard ? Thanks, Michael

3 Replies

AD Administrator Syncfusion Team August 26, 2005 12:00 PM UTC

The default behavior is to copy the selction which is the whole row. If you want some other behavior, then you can try handling the CurrentCellKeyDown event and doing the copy yourself.
private void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.C && (e.Modifiers & Keys.Control) != 0)
	{
		String s = this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText;
		Clipboard.SetDataObject(s);
		e.Handled = true;
	}
}


MC Michael Cruanes August 26, 2005 01:53 PM UTC

Thank you Clay, it works. How can I get the selected text when editing a cell ?


AD Administrator Syncfusion Team August 26, 2005 06:17 PM UTC

Try GridTextBoxCellRenderer cr = this.gridDataBoundGrid1.CurrentCell.Renderer as GridTextBoxCellRenderer; string s = cr.TextBox.SelectedText;

Loader.
Live Chat Icon For mobile
Up arrow icon