gridview Copying and Pasting

6 posts, 0 answers
  1. Erdem
    Erdem avatar
    14 posts
    Member since:
    Apr 2012

    Posted 21 Aug 2014 Link to this post

       Hi I write this code and I m trying someting . But when i click copying event then 3 times show messagebox "a" but  when i click pasting event then messagebox show 1 times "a".. Why copying event show 3 times ??

           private void radGridView1_Copying(object sender, GridViewClipboardEventArgs e)
            {
                MessageBox.Show("a");
                

            }

            private void radGridView1_Pasting(object sender, GridViewClipboardEventArgs e)
            {
                MessageBox.Show("a");
            }
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Aug 2014 Link to this post

    Hi Erdem,

    Thank you for writing.

    Here is a quote from our documentation regarding the copying event:
    RadGridView introduces Copying event which occurs when the grid has prepared appropriate data formats that represent the copy selection. This event is fired once for each supported format: DataFormats.Text, DataFormats.HTML, DataFormats.CommaSeparatedValue. You can cancel this event if the data is not allowed to be stored to Clipboard in a specific format, e.g. HTML format:
     
    I hope this clear things up. Let me know if you have any additional questions.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Karl
    Karl avatar
    35 posts
    Member since:
    Dec 2013

    Posted 14 Oct 2015 Link to this post

    This appears to happen when pasting directly from Excel. If I copy from excel and paste into the grid it will fire Pasting for HTML, Text AND CSV. 

     Is there any way to suppress this behavior?

  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 15 Oct 2015 Link to this post

    Hi Karl,

    The observed behavior is desired and expected and cannot be suppressed. We are checking what is the format of the data in the clipboard and we are firing the event for the respective formats. You could do the same if you want to limit to just one format.

    I hope this helps.

    Regards,
    Stefan
    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
  6. Karl
    Karl avatar
    35 posts
    Member since:
    Dec 2013

    Posted 15 Oct 2015 in reply to Stefan Link to this post

    Is there a way to control what format is copied from a Telerik grid row?  It appears to be coming in as HTML by default. 

    I want to be able to handle copying from a text file, excel, and another grid row. If I could count on the grid data being in text format I could ignore the other formats.

  7. Karl
    Karl avatar
    35 posts
    Member since:
    Dec 2013

    Posted 15 Oct 2015 in reply to Karl Link to this post

    Disregard my last post. I am now seeing all three formats pasted in.  I'm not sure what was going on before.
Back to Top
UI for WinForms is Visual Studio 2017 Ready