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

Cut/ copy/ Paster operation on multiple rows of an essential grid

For my application, I need to implement Cut/Copy and Paste operations on multiple rows of the gridcontrol. The user should be able to select multiple rows using Shift and Control keys and then he should be able to perform the cut copy operation on the selected rows. I am using a context menu having Cut, Copy and Paste as menu items. This menu is displayed on the right click of the mouse. Whenever I click on any of the menu items after selecting multiple rows ( using Shift and Control Keys) then only the row in which the mouse was clicked remains highlighted. So I am not able to capture which all rows does the user want to cut/copy. Kindly resolve this problem and send a sample application implementing the above operation.

3 Replies

AD Administrator Syncfusion Team December 1, 2004 06:36 AM

To avoid losing selection when you right click, try setting this property. this.grid.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left; In your menuhandlers, you can call these methods to copy/cut or paste the selections. grid.Model.CutPaste.Copy(); grid.Model.CutPaste.Cut(); grid.Model.CutPaste.Paste();


SJ Sapna Jain December 2, 2004 03:49 AM

There are a few problems with this: 1) I want the selection ( of multiple rows )to remain only if the rows were selected using Shift and Control keys. But if the left mouse button is clicked alone then only the current row should remain selected. 2) If I do Cut/Copy using the method after setting the property you have suggested then the rows which were cut/copied remains selected. When paste is clicked the selected rows are pasted back at the same location. 3)I have two more menu items in my application i) Insert Row ii) Delete Row So if I set this property this.grid.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left then in the insert click event handler I am not able to get the rowindex of the current row at which the user wants the new row to be inserted. this.grid.CurrentCell.RowIndex is equal to -1. So I am not able to call the grid.Rows.InsertRange function to insert the rows. Please help. >To avoid losing selection when you right click, try setting this property. > >this.grid.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left; > > >In your menuhandlers, you can call these methods to copy/cut or paste the selections. > >grid.Model.CutPaste.Copy(); >grid.Model.CutPaste.Cut(); >grid.Model.CutPaste.Paste(); > > > > >


AD Administrator Syncfusion Team December 2, 2004 04:32 AM

Here is a minimal sample. I think it handles your first 2 issues. It has code in the Popup event to get the click row/column you wanted for your issue 3. CutPasteContext_1532.zip

Loader.
Live Chat Icon For mobile
Up arrow icon