Skip to main content

MVCxClientHtmlEditor.PerformDataCallback(data) Method

Sends a callback with a parameter to process the passed information on the server, in an Action specified via the HtmlEditor’s HtmlEditorSettings.CustomDataActionRouteValues property, and then return the processing result to the ASPxClientHtmlEditor.CustomDataCallback event on the client. This method does not update the HtmlEditor.

Declaration

PerformDataCallback(
    data: any,
    onCallback?: ASPxClientDataCallback
): void

Parameters

Name Type Description
data any

An object containing any information that needs to be passed to a handling Action specified via the HtmlEditorSettings.CustomDataActionRouteValues property.

onCallback ASPxClientDataCallback

An ASPxClientDataCallback object that is the JavaScript function which receives the callback data as a parameter.

Remarks

Use the PerformDataCallback method if you need to asynchronously go to the server (using AJAX-based callback technology) and perform server-side processing in the specified Action. Via the PerformDataCallback method’s data parameter, you can pass any information collected on the client to the server, for further server processing.

The PerformDataCallback method posts back to the server using the callback technology and is handled in an Action specified by the HtmlEditor’s HtmlEditorSettings.CustomDataActionRouteValues property. Any data passed via the method’s data parameter can be accessed on the server as a parameter of the specified Action. So, the necessary server-side actions can be performed in the handling Action based upon the value(s) passed from the client.

For instance, you can pass values as a hash table.

Client Script Code:

myHtmlEditor.PerformDataCallback({key1: value});

Controller Code:

ActionResult MyAction(int key1){
    ...
}

The HtmlEditor does not automatically update (re-render) itself after a custom data callback has been sent and processed on the server.

If you need to perform actions on the client-side before and after callback processing, handle the MVCxClientHtmlEditor.BeginCallback and ASPxClientHtmlEditor.EndCallback events.

See Also