Cut/paste functionality in gridview

2 posts, 0 answers
  1. sriparthu
    sriparthu avatar
    3 posts
    Member since:
    Jul 2011

    Posted 01 Jan Link to this post


    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?


  2. Stefan X1
    Stefan X1 avatar
    485 posts

    Posted 05 Jan Link to this post

    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.

    Stefan X1
    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
  3. DevCraft R3 2016 release webinar banner
Back to Top