Skip to main content
All docs
V24.1

ASPxClientGridView.ClipboardCellPasting Event

Occurs before a cell is pasted to the control from the clipboard. Allows you to update the pasted data or skip a cell.

Declaration

ClipboardCellPasting: ASPxClientEvent<ASPxClientGridViewClipboardCellPastingEventHandler<ASPxClientGridView>>

Event Data

The ClipboardCellPasting event's data class is ASPxClientGridViewClipboardCellPastingEventArgs. The following properties provide information specific to this event:

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
cellInfo Obtains information about the processed cell.
newText Gets the new text of the processed cell.
newValue Specifies the new value of the processed cell.
oldText Gets the old text of the processed cell.
oldValue Gets the old value of the processed cell.

Remarks

The ClipboardCellPasting event fires before a cell is pasted to the control from the clipboard. If the clipboard contains multiple cells (EnableMultipleCellSelection), the event fires for each cell. The event allows you to modify data or to cancel pasting the processed cell.

The control does not paste cells if the required column cannot accept the pasted data (for example, if data types do not match).

The following example illustrates how to modify data before pasting to the control in the ClipboardCellPasting event handler:

DevExpress GridView - Copy and paste multiple cells

Web Forms:

<dx:ASPxGridView ID="GridView" runat="server" ...>
    <ClientSideEvents 
        ClipboardCellPasting="onClipboardCellPasting" />
    <SettingsEditing Mode="Batch">
        <BatchEditSettings EnableMultipleCellSelection="True" />
    </SettingsEditing>
</dx:ASPxGridView>
function onClipboardCellPasting(s, e) {
    if (e.cellInfo.column.fieldName == 'CategoryID') {
        // your code
        e.cancel = true;
    }
    else {
      e.newText += " copy"; 
    }
}

MVC:

@Html.DevExpress().GridView(settings => {
    settings.Name = "grid";
    settings.ClientSideEvents.CellSelectionChanging = "function (s, e) { 
        if (e.cellInfo.column.fieldName == 'CategoryID') {
            // your code
            e.cancel = true;
        }
        else {
          e.newText += " copy"; 
        }
    }"; 
    settings.Columns.Add("CategoryID");
    ...
}).Bind(Model).GetHtml()
See Also