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
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.
Thanks for that piece of code. It indeed is handy.
Many Thanks
Pradeep
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...
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
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
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