Skip to main content

RichEditSettings.CustomActionRouteValues Property

Defines the custom callback routing logic by specifying the names of a Controller and an Action which should handle custom callbacks initiated by the MVCxClientRichEdit.PerformCallback method.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public object CustomActionRouteValues { get; set; }

Property Value

Type Description
Object

An object containing the Controller and Action names.

Remarks

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

The client PerformCallback method posts back to the server using the callback technology and is handled in an Action specified by the CustomActionRouteValues 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.

Run Demo: Rich Text Editor - Custom Document Management

@Html.DevExpress().RichEdit(settings => {
    settings.Name = "RichEdit";
    settings.CallbackRouteValues = new { Controller = "DocumentManagement", Action = "CustomDocumentManagementPartial" };
    settings.CustomActionRouteValues = new { Controller = "DocumentManagement", Action = "OpenFile" };
    settings.WorkDirectory = DirectoryManagmentUtils.DocumentBrowsingFolderPath;
    // ...
    settings.ClientSideEvents.BeginCallback = "OnRichEditBeginCallback";
    settings.ClientSideEvents.EndCallback = "OnRichEditEndCallback";
    settings.PreRender = (s, e) => {
        MVCxRichEdit richEdit = (MVCxRichEdit)s;
        richEdit.Focus();
    };
}).Open(Path.Combine(DirectoryManagmentUtils.DocumentBrowsingFolderPath, "Example.rtf")).GetHtml()
var filePath = null;
function OnSelectedFileChanged(s, e) {
    if(e.file) {
        filePath = s.GetCurrentFolderPath() + "\\" + e.file.name;
        if(!RichEdit.InCallback())
            RichEdit.PerformCallback({ "filePath": filePath });
    }
}
function OnRichEditBeginCallback(s, e) {
    e.customArgs["filePath"] = filePath;
    filePath = null;
}
function OnRichEditEndCallback(s, e) {
    if(filePath != null)
        RichEdit.PerformCallback();
}
public ActionResult OpenFile(string filePath) {
    return RichEditExtension.Open("RichEdit", Path.Combine(DirectoryManagmentUtils.CurrentDataDirectory, filePath));
}
See Also