ASPxClientVerticalGrid.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<ASPxClientVerticalGridClipboardCellPastingEventHandler<ASPxClientVerticalGrid>>
Event Data
The ClipboardCellPasting event's data class is ASPxClientVerticalGridClipboardCellPastingEventArgs. 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 row 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:
Web Forms:
<dx:ASPxVerticalGrid ID="VerticalGrid1" runat="server" ...>
<ClientSideEvents
ClipboardCellPasting="onClipboardCellPasting" />
<SettingsEditing Mode="Batch">
<BatchEditSettings EnableMultipleCellSelection="True" />
</SettingsEditing>
</dx:ASPxVerticalGrid>
function onClipboardCellPasting(s, e) {
if (e.cellInfo.row.fieldName == 'CategoryID') {
// your code
e.cancel = true;
}
else {
e.newText += " copy";
}
}
MVC:
@Html.DevExpress().VerticalGrid(settings => {
settings.Name = "verticalGrid";
settings.ClientSideEvents.CellSelectionChanging = "function (s, e) {
if (e.cellInfo.row.fieldName == 'CategoryID') {
// your code
e.cancel = true;
}
else {
e.newText += " copy";
}
}";
settings.Rows.Add("CategoryID");
...
}).Bind(Model).GetHtml()