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

RIGHT Click cut/paste popup behavior in GridControl

I would like to duplicate the right click behavior that a TextBox has, in a GridControl. So when I right click in a cell I get the "Undo Cut Copy Paste..." PopUp menu. Thanks

2 Replies

AD Administrator Syncfusion Team April 26, 2006 04:46 AM UTC

Hi Brian The standard context menu of a TextBox can be achieved in a GridControl by setting the CellType to OriginalTextBox. Also the CurrentCellControlGotFocus event must be handled and there null must be set to the control’s ContextMenu to make sure that any other/empty context menu would not take the precedence over the default TextBox context menu. Below is a code snippet. Let us know if you need any further assistance. this.gridControl1.CurrentCellControlGotFocus += new System.Windows.Forms.ControlEventHandler(this.gridControl1_CurrentCellControlGotFocus); //Add Event Handler this.gridControl1.TableStyle.CellType = "OriginalTextBox"; //Set cell type private void gridControl1_CurrentCellControlGotFocus(object sender, System.Windows.Forms.ControlEventArgs e) { e.Control.ContextMenu = null; } Regards, Calvin.


AD Administrator Syncfusion Team April 26, 2006 04:53 PM UTC

Calvin, This works great! Thanks >Hi Brian > >The standard context menu of a TextBox can be achieved in a GridControl by setting the CellType to OriginalTextBox. Also the CurrentCellControlGotFocus event must be handled and there null must be set to the control’s ContextMenu to make sure that any other/empty context menu would not take the precedence over the default TextBox context menu. Below is a code snippet. Let us know if you need any further assistance. > >this.gridControl1.CurrentCellControlGotFocus += new System.Windows.Forms.ControlEventHandler(this.gridControl1_CurrentCellControlGotFocus); //Add Event Handler > >this.gridControl1.TableStyle.CellType = "OriginalTextBox"; //Set cell type > > >private void gridControl1_CurrentCellControlGotFocus(object sender, System.Windows.Forms.ControlEventArgs e) > { > e.Control.ContextMenu = null; > } > > >Regards, >Calvin.

Loader.
Live Chat Icon For mobile
Up arrow icon