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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Right Click Menu for Copy Paste

Thread ID:

Created:

Updated:

Platform:

Replies:

69877 Nov 15,2007 11:52 AM UTC Nov 15,2007 06:49 PM UTC WinForms 1
loading
Tags: GridControl
Arif Eqbal
Asked On November 15, 2007 11:52 AM UTC

I am using a Grid Grouping Control that is bound to a List. While I am editing a Cell content, I am able to copy the content using Ctrl + C, while pasting the data if I select a part of text in the cell and Paste (Ctrl + V) it does not paste the data, however, if nothing is selected it pastes fine. Is this a bug or is there a way to correct it? Also is it possible to show the normal context menu for Cut/Copy/Paste that we usually see in any .NET control like textBox?


haneefm [Syncfusion]
Replied On November 15, 2007 06:49 PM UTC

Hi Arif,

is it possible to show the normal context menu for Cut/Copy/Paste that we usually see in any .NET control like textBox?
>>>>>>
Yes, you need to set ContextMenu property to display the standard menu in a grid when you right clicked on the cell. Below are the codes:

//for showing the menu when right mouse button is clicked.
this.grid.ContextMenu = this.contextMenu1;

Regarding the Pasting Issue:
>>>>>>>>
You can handle the TableControlCurrentCellKeyDown event of the grid and call the GridTextBoxCellRenderer.Paste method to paste text when the celltext has been selected. Here are the codes:

private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if( e.Inner.Modifiers == Keys.Control
&& e.Inner.KeyCode == Keys.V )
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if( cc.IsEditing )
{
GridTextBoxCellRenderer cr = cc.Renderer as GridTextBoxCellRenderer;
if( cr != null && cr.TextBox.SelectedText != string.Empty )
{
cr.TextBox.SelectedText = string.Empty;
cr.TextBox.SelectionLength = 0;
cr.Paste();
}
}
}
}


Best regards,
Haneef


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;