[]
        
(Showing Draft Content)

Clipboard

FlexGrid supports standard clipboard operations through the AutoClipboard property. When AutoClipboard is set to true, users can copy, paste, and cut cell values by using standard keyboard shortcuts. The PreventCut property controls whether the grid processes cut operations. PreventCut applies only when AutoClipboard is enabled.


Clipboard Behavior

Configuration

Behavior

AutoClipboard = false

FlexGrid ignores clipboard keyboard shortcuts. PreventCut has no effect.

AutoClipboard = true, PreventCut = false

FlexGrid performs the default cut operation. Selected values are copied to the clipboard, and editable cell values are cleared. Read-only cells are copied but remain unchanged. Rows are not deleted.

AutoClipboard = true, PreventCut = true

FlexGrid does not process cut shortcuts. Copy and paste behavior remains available, and applications can handle the shortcut through custom logic or a parent element.

The default value of PreventCut is false.

C1Web FlexGrid - Filtering the Country name in Filtering.


Code Snippets

The following example enables clipboard support and suppresses the built-in cut operation.

Controllers

Add the following action method to configure the clipboard settings for the FlexGrid sample.

private static List<Sale> _clipboardSource = Sale.GetData(20).ToList();
public ActionResult Index()
{
    return View(_clipboardSource);

MVC View

Add the following configuration to enable clipboard operations and prevent cut behavior.

@(Html.C1().FlexGrid<Sale>()
    .Id("clipboardGrid")
    .Bind(Model)
    .AutoGenerateColumns(false)
    .AutoClipboard(true)
    .PreventCut(true)
    .Columns(columns =>
    {
        columns.Add(c => c.Binding("ID").Header("Id").IsReadOnly(true));
        columns.Add(c => c.Binding("Country").Header("Country"));
        columns.Add(c => c.Binding("Product").Header("Product"));
        columns.Add(c => c.Binding("Amount").Header("Amount").Format("c2"));
        columns.Add(c => c.Binding("Active").Header("Active"));
    })
)