RadGrid Context Menu Copy

9 posts, 0 answers
  1. Senthil Gnaesa
    Senthil Gnaesa avatar
    3 posts
    Member since:
    Mar 2010

    Posted 21 Jun 2010 Link to this post

    Hi,

    How to use default context menu items like copy from radgrid context menu as i am able to use delete item from a gird , delete a  row by right clicking on the context menu items and able to delete a row, similarly i need copy a row using context menu  copy


    Thanks,
    Senthil
  2. Senthil Gnaesa
    Senthil Gnaesa avatar
    3 posts
    Member since:
    Mar 2010

    Posted 21 Jun 2010 Link to this post

    Also in continuation to the below thread how to copy a cell values from the grid provided when the gird is edit mode using hot keys
  3. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 24 Jun 2010 Link to this post

    Hi Senthil Gnaesa,

    The copy context menu item can copy/paste cell values between grid cells. Currently, the functionality  for copy/paste of grid rows between different instances of RadGridView is not built-in. Nevertheless, you can find sample implementations in following KB articles:
    Copy/Pasting rows in and between RadGridViews
    Implementing "Copy/Paste to Excel" functionality in RadGridView for WinForms

    We plan to include this functionality in RadGridView in one of our upcoming releases. 

    When there is an active editor in RadGridView, you can use all standard hot keys in order to copy/paste text (e.g. Control+C; Control+V). 

    I hope this helps.

    Greetings,
    Jack
    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
  4. Clara
    Clara avatar
    14 posts
    Member since:
    Oct 2016

    Posted 28 Mar 2018 Link to this post

    Hi Team,

    I have a problem trying to paste a value into the cells selected in the radgrid (Winforms).

    The thing is that I want to copy an specific value from a cell and then copy that value into the cells that I have selected.

    How can I achieve that? 

    Thanks a lot in advance!

  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3273 posts

    Posted 28 Mar 2018 Link to this post

    Hello, Clara,  

    You can select a certain cell, right click with the mouse and select the Copy option from the context menu. This will copy only the specific cell's value. Then select another cell, right click with the mouse and select the Paste option from the context menu. The value will be pasted in the target cell. The attached gif file illustrates the behavior on my end with the latest version.

    I hope this information helps. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  6. Clara
    Clara avatar
    14 posts
    Member since:
    Oct 2016

    Posted 28 Mar 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Dess,

    Yes, I know I can do that but I was refering to another thing.

    We need to copy one value (for example "20"), which we do it as you mentioned above or even using Ctrl+C but we want to paste that value into the cells selected (for differents rows), instead of having to do it one by one. Sometimes we need to fill one cell for 100 rows with that value so it will be easy if you copy the value first and then paste it in all the selected cells where we want to paste it like we do it in Excel. My question is regarding "pasting into multiple cells selected". How can we achieve that? How can we paste one value into various selected cells?

    It is very urgent for us to achieve this. I know that for WPF it is SelectionMode="Extended" and SelectionUnit="AllCellSelected" but how can we achieve that using winforms?

    Please help us!!! Many thanks in advance!

     

     

  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3273 posts

    Posted 29 Mar 2018 Link to this post

    Hello, Clara,  

    If I understand your requirement correctly, you want to copy a single cell's value, select many cells and paste the copied value to all of the selected cells. I suppose that you set the SelectionMode property to CellSelect. Then, you can handle the RadGridView.Pasting event and set the clipboard value to all selected cells. Here is a sample code snippet which result is illustrated in the attached gif file:
    public RadForm1()
    {
        InitializeComponent();
     
        this.radGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect;
        this.radGridView1.MultiSelect = true;
        this.radGridView1.Pasting += radGridView1_Pasting;
    }
     
    private void radGridView1_Pasting(object sender, Telerik.WinControls.UI.GridViewClipboardEventArgs e)
    {
        string data = Clipboard.GetData(DataFormats.Text).ToString();
        if (data != string.Empty)
        {
            this.radGridView1.BeginUpdate();
            foreach (GridViewCellInfo cell in this.radGridView1.SelectedCells)
            {
                if (cell.IsCurrent == false)
                {
                    cell.Value = data;
                }
            }
            this.radGridView1.EndUpdate();
        }
    }

    Off topic, note that most of the forum threads are reviewed by Telerik representatives and we address the questions asked by our customers in the forums as well. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

    I hope this information helps. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  8. Luis
    Luis avatar
    11 posts
    Member since:
    Dec 2018

    Posted 11 Mar in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Dess, I try to apply this function to RadSpreadSheet with merged cells, when left click show the opcion to copy/paste/delete.. etc,

    so when copy the cells and paste appears a pop up that say "Cannot change part of a merged cell." Do you know a way to can copy paste?

  9. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3273 posts

    Posted 12 Mar Link to this post

    Hello, Luis,

    RadGridView and RadSpreadsheet are two different controls and they have different internal implementation. That is why the suggested approach for pasting in RadGridView is not applicable for RadSpreadsheet.

    You can prevent the default logic for pasting in order to prevent the message box from appearing. For this purpose it is necessary to cancel the SpreadsheetElement.WorkbookCommandExecuting event, store information which cells are merged, then unmerge the cells, set the stored value in the clipboard and then merge the cells again.

            private void SpreadsheetElement_WorkbookCommandExecuting(object sender, Telerik.Windows.Documents.Spreadsheet.Commands.CommandExecutingEventArgs e)
            {
                if (e.CommandName == "SetCellPropertyValuesCommand")
                {
                    e.Cancel(); 
    //TODO
                }
            }

    Additional information about mergin cells and setting values to the cells is available in the following help articles:
    https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/merge-unmerge-cells
    https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/cell-value-types

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top