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

RadGrid Context Menu Copy

8 Answers 517 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Senthil Gnaesa
Top achievements
Rank 1
Senthil Gnaesa asked on 21 Jun 2010, 06:39 AM
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

8 Answers, 1 is accepted

Sort by
0
Senthil Gnaesa
Top achievements
Rank 1
answered on 21 Jun 2010, 02:10 PM
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
0
Jack
Telerik team
answered on 24 Jun 2010, 08:27 AM
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
0
Clara
Top achievements
Rank 1
answered on 28 Mar 2018, 01:07 PM

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!

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Mar 2018, 01:32 PM
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.
0
Clara
Top achievements
Rank 1
answered on 28 Mar 2018, 01:43 PM

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!

 

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 Mar 2018, 08:54 AM
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.
0
Luis
Top achievements
Rank 1
answered on 11 Mar 2019, 08:46 PM

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?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Mar 2019, 12:12 PM
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.
Tags
ContextMenu
Asked by
Senthil Gnaesa
Top achievements
Rank 1
Answers by
Senthil Gnaesa
Top achievements
Rank 1
Jack
Telerik team
Clara
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Luis
Top achievements
Rank 1
Share this question
or