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

Copy and Paste with vertical selection does not work

4 Answers 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adriano
Top achievements
Rank 1
Adriano asked on 06 Mar 2013, 01:12 PM
HI,

I used to use the behaviour on this thread (http://www.telerik.com/community/forums/silverlight/gridview/radgridview-copy-paste-to-from-excel-questions.aspx) in order to have Cell and Row sellection mode and Copy and Paste from Excel working as expected.

Now I have this:
SelectionMode="Extended"
SelectionUnit="Mixed"
ClipboardPasteMode="OverwriteWithEmptyValues,AllSelectedCells"

When I Copy and Paste to/from Excel it works perfectly, but when I try to Copy and Paste to/from the grid it ignores the empty cells if the selection is vertical, when it's horizontal it works fine. Like this:

Before copy/paste

  1. Column 1 - Column 2 - Column 3 
  2. - Value 2   -
  3. Value 4 - Value 5 -
  4. - Value 8 - Value 9

So I select all cells in Column 1 press CTRL+C and select the cell with Value 2, so the final grid is going to be like this (ignoring empty cells):

  1. Column 1 - Column 2 - Column 3 
  2. - Value 4   -
  3. Value 4 - Value 5 -
  4. - Value 8 - Value 9


How can I make this vertical selection to work?

Thanks,
Adriano.

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 07 Mar 2013, 11:36 AM
Hello Adriano,

I have tested selecting empty cell's values, copying them and then selecting cells and Pasting the copied content over them. As result the empty content was not pasted. Would you please confirm if this is the problem you have encountered?

Then you say that if the selection is horizontal it works fine, would you please clarify how do you copy/paste with horizontal empty values?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Adriano
Top achievements
Rank 1
answered on 07 Mar 2013, 02:11 PM
Didie,

Yes, this is the problem (vertical copy/paste) I mentioned. Is there any solution for this?

About the horizontal I'm saying that if I do horizontal copy/paste :

Before copy/paste (Row numbers are just for clarification)

  1. Column 1 - Column 2 - Column 3 
  2.                 - Value 2   -
  3. Value 4    - Value 5 -
  4.                 - Value 8 - Value 9

So I select all cells in Row 2 press CTRL+C and select the first cell  in row 4, so the final grid is going to be like this (working fine):

  1. Column 1 - Column 2 - Column 3 
  2.                 - Value 2   -
  3. Value 4    - Value 5 -
  4.                 - Value 2 -

So I think this vertical problem can be handled like horizontal pasting.

Thanks,
Adriano.

0
Vera
Telerik team
answered on 11 Mar 2013, 01:33 PM
Hello Adriano,

 
I tried to reproduce the problem using the details you provided but to no avail. I have attached the project  and a video of the test. Please take a look at them. Am I missing something? Are you able to get the problematic behavior on the sample attached?

Greetings,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Adriano
Top achievements
Rank 1
answered on 15 Mar 2013, 12:04 AM
I corrected it before you post with this:

ON XAML: CopyingCellClipboardContent="gvMain_CopyingCellClipboardContent"

On code behind:

 private void gvMain_CopyingCellClipboardContent(object sender, GridViewCellClipboardEventArgs e)
        {
            if (e.Value == null)
            {
                e.Value = string.Empty;
            }
        }

so now it works all the time and with any kind of selection.

THanks for your patience.
Tags
GridView
Asked by
Adriano
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Adriano
Top achievements
Rank 1
Vera
Telerik team
Share this question
or