The Grid Control supports row copy and paste operations out-of-the-box. Set the GridView.OptionsClipboard.PasteMode property to Update
or Append
to enable the Paste from Clipboard functionality.
Users can copy/paste rows to/from the Clipboard using the CTRL
+C
and CTRL
+V
(or Shift
+Insert
) shortcuts, respectively.
Use the GridView.CopyToClipboard and GridView.PasteFromClipboard methods to copy/paste rows in code.
Files to Review
Documentation
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
C#using System;
using System.Collections.Generic;
using System.Linq;
using DevExpress.XtraEditors;
namespace PasteData {
public partial class Main : XtraForm {
public Main() {
InitializeComponent();
gridControl1.DataSource = DataHelper.GetData(10);
gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsClipboard.PasteMode = DevExpress.Export.PasteMode.Append;
}
private void OnButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e) {
if (e.Button.Properties.Caption == "Copy") {
gridView1.CopyToClipboard();
}
if (e.Button.Properties.Caption == "Paste") {
gridView1.PasteFromClipboard();
}
}
}
}