This is a migrated thread and some comments may be shown as answers.

Cut/paste functionality in gridview

1 Answer 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sriparthu
Top achievements
Rank 1
sriparthu asked on 01 Jan 2016, 09:35 AM

Hi,

Right now,we are able to do copy/paste  for cells in the grid view.Do we have the similar functionality for cut/paste in the gridview?

If so, could you provide us the sample code?

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 Jan 2016, 11:29 AM
Hi Sriparthu,

I am afraid, that RadGridView does not provide out-of-the box support for cut operations. However, you can implement a custom Keyboard Command Provider. Within the overriden ProvideCommandsForKey method you can add the following check for a cut operation.
if (key == Key.X && Keyboard.IsKeyDown(Key.LeftCtrl))
{
     
}

Within the if-statement, you can simply iterate through the selected items of RadGridView through its SelectedItems property and remove them from the Items collection.

As for the pasting operation, you will have to implement custom logic for handling it. You can take a look at the following articles for further reference.

- Clipboard Handlingwith .NET
- Copying multiple items to the clipboard
- Saving and obtaining custom objects to/from Windows Clipboard
- How to: Add Data to the Clipboard

Hope this helps.

Regards,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
sriparthu
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or