ASPxClientTreeList.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<ASPxClientTreeListClipboardCellPastingEventHandler<ASPxClientTreeList>>
Event Data
The ClipboardCellPasting event's data class is ASPxClientTreeListClipboardCellPastingEventArgs. 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 | Obtains the old value of the 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:
Web Forms:
<dx:ASPxTreeList ID="TreeList1" runat="server" ...>
<ClientSideEvents
ClipboardCellPasting="onClipboardCellPasting" />
<SettingsEditing Mode="Batch">
<BatchEditSettings EnableMultipleCellSelection="True" />
</SettingsEditing>
</dx:ASPxTreeList>
function onClipboardCellPasting(s, e) {
if (e.cellInfo.column.fieldName == 'CategoryID') {
// your code
e.cancel = true;
}
else {
e.newText += " copy";
}
}
MVC:
@Html.DevExpress().TreeList(settings => {
settings.Name = "treeList";
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()