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

Copy/Paste from grid

3 Answers 597 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 25 May 2011, 07:58 PM
Hi,

I would like to know if it's possible to "Copy" cells content of a RadGridView using Windows "Copy/Paste" standard function?

Thank's

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 26 May 2011, 08:30 AM
Hi Oliver,

RadGridView does support copy/paste functionality. Here you can find more information about this feature. 


Best wishes,
Milan
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Oliver
Top achievements
Rank 1
answered on 26 May 2011, 02:34 PM
Hi,

if the "SelectionUnit" property is set to  "FullRow", is it possible to copy only the content of the cell who have the focus when the mouse is over it?

Thank's
0
Dimitrina
Telerik team
answered on 28 May 2011, 08:35 AM
Hello Oliver,

 When SelectionUnit is FullRow the grid will copy and paste whole rows. Contrary, when SelectionUnit is Cell the grid will paste and copy only selected cells. The pasting operation begin from the first selected unit.

Regarding your question if it possible to copy only the content of the cell who have the focus: 
You could add an additional logic to the CopyingCellClipboardContent and PastingcellClipboardContent events of the GridView, so that you check what is the focused cell when copying and remember its DisplayIndex. Then on pasting you may paste the copied value to the cell of the row with this DisplayIndex.

If the name of your grid is clubsGrid, the code would look like:

private void clubsGrid_PastingCellClipboardContent(object sender, GridViewCellClipboardEventArgs e)
        {
            if (e.Cell.Column.DisplayIndex != currentCellDisplayIndex)
            {
                e.Cancel = true;
            }
        }
 
        private void clubsGrid_CopyingCellClipboardContent(object sender, GridViewCellClipboardEventArgs e)
        {
            if (clubsGrid.CurrentCellInfo.Column.DisplayIndex == e.Cell.Column.DisplayIndex)
            {
                currentCellDisplayIndex = e.Cell.Column.DisplayIndex;
            }
        }

You may take a look at this forum post as well.

Greetings,
Didie
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Oliver
Top achievements
Rank 1
Answers by
Milan
Telerik team
Oliver
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or