Pasting functioanality in gridview through click of a button?

7 posts, 1 answers
  1. Pradeep
    Pradeep avatar
    10 posts
    Member since:
    Dec 2010

    Posted 10 Oct 2012 Link to this post

    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
  2. Answer
    Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 11 Oct 2012 Link to this post

    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.

  3. DevCraft banner
  4. Pradeep
    Pradeep avatar
    10 posts
    Member since:
    Dec 2010

    Posted 12 Oct 2012 Link to this post

    Hi Yoan,

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

    Many Thanks
    Pradeep
  5. Matej
    Matej avatar
    2 posts
    Member since:
    May 2013

    Posted 29 Feb Link to this post

    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...

  6. Martin Vatev
    Admin
    Martin Vatev avatar
    87 posts

    Posted 02 Mar Link to this post

    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
  7. Matej
    Matej avatar
    2 posts
    Member since:
    May 2013

    Posted 02 Mar in reply to Martin Vatev Link to this post

    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

     

  8. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 03 Mar Link to this post

    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
Back to Top
DevCraft banner