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

Insert new rows into radgridview by copy / paste from Excel

8 Answers 347 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tanguy Detroz
Top achievements
Rank 1
Tanguy Detroz asked on 22 Jul 2010, 04:57 PM
Hi,

I just installed the Q2 today and I am very please that you are now supporting the clipboard while copying data from or to excel. Nevertheless, I didn't find a lot of information regarding these new functionalities (am I missing the documentation here, please provide if so).

My question is simple : Is there a quick way to copy / paste rows from excel to the gridview by creating new rows. In other words, we have hundreds of rows of data in excel and we need to import these, quickly, into the grid which has got exactly the same column definition (I am not talking about creating column, just rows).

I hope that you understand my question and would like to congratulate you guys, the telerik suite is pretty awsome and really fits our business requirments.

R.

8 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 04:59 PM
Hi Tanguy Detroz,

 If the underlying data collection is modifiable, the RadGridView should create the new rows automatically and place the data from the Clipboard in them.

Best wishes,
Yavor Georgiev
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
Tanguy Detroz
Top achievements
Rank 1
answered on 22 Jul 2010, 05:10 PM
I am sorry but I am afraid not to understand that completely : what do you mean by "modifiable". Once I have all the rows in my clipboard, how (where do I click) can I paste them into the grid, create these new rows and which parameter of the grid should I change.

Thanks for answering that fast.
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 05:17 PM
Hello Tanguy Detroz,

 I mean if you can add new items to that data collection. If you bind the RadGridView to a Collection, the grid will automatically insert new rows when you press Ctrl + V. However, if you bind to an array (where you can't add new items), the RadGridView will only paste as many items as it can currently hold.

Sincerely yours,
Yavor Georgiev
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
Tanguy Detroz
Top achievements
Rank 1
answered on 23 Jul 2010, 09:00 AM
Thank you, I am going to try that now. By the way, is there any demo or example of these copy / paste functionnalities from excel, somewhere ? I could not find it in your telerik demo website.

Thanks.
0
Yavor Georgiev
Telerik team
answered on 23 Jul 2010, 09:06 AM
Hi Tanguy Detroz,

 Unfortunately, we still have not updated our documentation to include a help topic on copy and paste, but we are working on this right now. However, you can check out this blog post that demonstrates the copy/paste functionality, published shortly before the official release of the 2010 Q2 version of our controls..

Regards,
Yavor Georgiev
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
Tanguy Detroz
Top achievements
Rank 1
answered on 23 Jul 2010, 09:35 AM

Mr Georgiev

I am afraid there is something I don't get here ... Let's take an easy example : I have one grid:

<

 

 

telerik:RadGridView x:Name="MyGrid" CanUserInsertRows="True">

 

 

 

 

 

</telerik:RadGridView>

And, on the other side, I have a collection of string binded to it :

 

public

 

 

ObservableCollection<string> myCollection = new ObservableCollection<string>();

 

 

 

 

public MainPage()

 

{

InitializeComponent();

 

 

 

MyGrid.ItemsSource =

 

 

this.myCollection;

 

}

So in excel, I have one column with strings :

String 1
String 2
String 3

When I copy these three cells and then paste them to the grid, there is popup asking me if I authorize silverlight to access my clipboard and then : nothing ... What am I doing wrong here ?

Thanks in advance,

 

 

0
Yavor Georgiev
Telerik team
answered on 23 Jul 2010, 10:25 AM
Hello Tanguy Detroz,

 Your example does not work, because the String type does not have a parameterless constructor and so we cannot add new rows. Please check out the attached project, which uses a custom type with a default parameterless constructor.

Kind regards,
Yavor Georgiev
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
Tanguy Detroz
Top achievements
Rank 1
answered on 23 Jul 2010, 10:57 AM
Thank you, it is exactly what I needed.
Tags
GridView
Asked by
Tanguy Detroz
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Tanguy Detroz
Top achievements
Rank 1
Share this question
or