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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





22006 Dec 1,2004 09:08 AM UTC Dec 2,2004 09:32 AM UTC WinForms 3
Tags: GridControl
Sapna Jain
Asked On December 1, 2004 09:08 AM UTC

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.

Administrator [Syncfusion]
Replied On December 1, 2004 11:36 AM UTC

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();

Sapna Jain
Replied On December 2, 2004 08:49 AM UTC

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(); > > > > >

Administrator [Syncfusion]
Replied On December 2, 2004 09:32 AM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon