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

Pasting into a Grid with hidden Columns

2 Answers 82 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Scott
Top achievements
Rank 1
Scott asked on 02 Aug 2010, 07:16 PM
Hello,
I am having a problem pasting data from Excel into a Grid that is bound to an ObservableCollection when the Grid also has hidden columns. I have the following:

 

 


Dim
coll As ObservableCollection(Of ParcelDetail) = New ObservableCollection(Of ParcelDetail)

 

GridViewExcel.ItemsSource = coll


Lets say that Parcel detail has three properties of String (Col1, Col2, Col3)

In the DataLoaded event I hide Col2.

My Sample Excel Data is:
Row1Col1    Row1Col2
Row2Col1    Row2Col2
If I paste this into the grid I end up with my XXXCol1 in the first Column but the second column is empty

Now if I change my Sample Excel Data to:
Row1Col1    Row1Col2    Row1Col3
Row2Col1    Row2Col2    Row2Col3
And I paste this in I get XXXCol1 in the first Column and XXXCol3 in the second column

From what I can tell is that the paste isn't actually happening into the grid itsself but rather the underlying object which is why hiding columns isn't doing what I expect. Is there any recommended way to handle this scenario? I allow my users to select what columns to hide before showing the grid so I cannot hard code any type of column hide because I will not know beforehand.

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 05 Aug 2010, 12:41 PM
Hi Scott,

Actually the Excel behaves the same way and I think this is the reason we implemented it that way.

Still, we agree that you should be able to choose whether you want this behavior or not, so we will add a new value to the ClipboardPasteMode in the next version to allow switching off this behavior.

I have added it as a feature request in the public issue tracking system and you can go vote for it here.


All the best,
Veskoni
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
Scott
Top achievements
Rank 1
answered on 05 Aug 2010, 05:57 PM
Thanks for the info. What I ended up doing is manually create the grid columns in code behind instread of hiding them and it appears to work. This still might be a good feature for a futire release. Thanks much.
Tags
GridView
Asked by
Scott
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Scott
Top achievements
Rank 1
Share this question
or