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

Pasting functioanality in gridview through click of a button?

6 Answers 51 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pradeep
Top achievements
Rank 1
Pradeep asked on 10 Oct 2012, 10:27 AM
Hi,

I have a grid view bound to an employee collection in the view model with 0 records in it. I have an excel with the list of employees to be pasted to the grid view. It works well when I focus the grid and click Ctrl-V. I need to paste when I click a button. Is that possible?

Many Thanks

6 Answers, 1 is accepted

Sort by
0
Accepted
Yoan
Telerik team
answered on 11 Oct 2012, 04:29 PM
Hello Pradeep,

 Yes it is possible through RadGridView' Commands. You can subscribe to the click event of a button and execute the paste command to your GridView. Check the following code snippet:

private void Button1_Click(object sender, RoutedEventArgs e)
       {
           var pasteCommand = RadGridViewCommands.Paste as RoutedUICommand;
           pasteCommand.Execute(null,this.clubsGrid);
       }

I hope this helps you.

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Pradeep
Top achievements
Rank 1
answered on 12 Oct 2012, 02:50 PM
Hi Yoan,

Thanks for that piece of code. It indeed is handy.

Many Thanks
Pradeep
0
Matej
Top achievements
Rank 1
answered on 29 Feb 2016, 02:14 PM

Hello, 

after applying Q1 2016 update paste function does not work anymore.

var pasteCommand = RadGridViewCommands.Paste as RoutedUICommand;<br>if (pasteCommand != null) pasteCommand.Execute(null, dgEcolabResultSet);

There is no exception, only datasource has no elements...

0
Martin
Telerik team
answered on 02 Mar 2016, 05:14 PM
Hi Matej,

Thank you for contacting us.

I guess that you're trying to paste in empty RadGridView. If this is the case, it is a known issue that has already been fixed in our latest version. 

Can you confirm whether this is the problem?

Regards,
Martin Vatev
Telerik
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
0
Matej
Top achievements
Rank 1
answered on 02 Mar 2016, 08:25 PM

Hi Martin,

thank you for your reply, I can confirm, that the radgridview was empty on executing copy command. But I am absolutely sure, that I installed latest version availible, because the update was made on Sunday 28th of February.

I have checked the version control, the update was made from: 2015.3.1104.1050 to 2016.1.217.1050. If Telerik Control Panel by default installs the latest version, then it should be Q1 2016 SP1. So bug wasn't fixed after all.

Best Regards,

Matej

 

0
Maya
Telerik team
answered on 03 Mar 2016, 07:18 AM
Hi Matej,

The issue was resolved in our internal builds. Please download the latest one from your Telerik account and give it a try. For more information about the LIB, check out the "Using the Hotfix" article.

Regards,
Maya
Telerik
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
Tags
GridView
Asked by
Pradeep
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Pradeep
Top achievements
Rank 1
Matej
Top achievements
Rank 1
Martin
Telerik team
Maya
Telerik team
Share this question
or