Skip to main content

SpreadsheetExtension.GetCallbackResult(SpreadsheetSettings) Method

Returns the specified result back to the client side after processing a callback within an Action specified by the SpreadsheetSettings.CallbackRouteValues property.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public static ActionResult GetCallbackResult(
    SpreadsheetSettings settings
)

Parameters

Name Type Description
settings SpreadsheetSettings

A SpreadsheetSettings object specifying the processed Spreadsheet’s settings.

Returns

Type Description
ActionResult

A ActionResult object that is the result of an action method.

Remarks

Use this method in an Action specified by the SpreadsheetSettings.CallbackRouteValues property to return the result of callback processing back to the client.

public static class SpreadsheetSettingsHelper {
    public static SpreadsheetSettings GetSpreadsheetSettings(FileData file) {
        SpreadsheetSettings settings = new SpreadsheetSettings();
        settings.Name = "DemoSheet";
        settings.CallbackRouteValues = new { Controller = "Home", Action = "DocumentCallBack" };
        settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
        settings.Height = 500;
        settings.ReadOnly = false;
        settings.RibbonMode = SpreadsheetRibbonMode.OneLineRibbon;
        settings.Settings.Behavior.SaveAs = DevExpress.XtraSpreadsheet.DocumentCapability.Hidden;
        settings.Settings.Behavior.Open = DevExpress.XtraSpreadsheet.DocumentCapability.Hidden;
        settings.Settings.Behavior.CreateNew = DevExpress.XtraSpreadsheet.DocumentCapability.Hidden;
        settings.ClientSideEvents.BeginCallback = "onDocFileBeginCallback";
        settings.Saving = (s, e) => {
            var filePath = string.Format("{0}/{1}{2}", file.FilePath, file.FileName, file.FileExtension);
            byte[] bytes = SpreadsheetExtension.SaveCopy("DocInlineImg", file.DocumentFormat);
            System.IO.File.WriteAllBytes(filePath, bytes);
            e.Handled = true;
        };
        return settings;
    }
}
//Controller
public ActionResult DocumentCallBack() {
...
    // Pass the SpreadsheetSettings object with the same settings as in Partial View.
    return SpreadsheetExtension.GetCallbackResult(SpreadsheetSettingsHelper.GetSpreadsheetSettings(file));
}
@Html.DevExpress().Spreadsheet(SpreadsheetSettingsHelper.GetSpreadsheetSettings(null)).GetHtml()

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetCallbackResult(SpreadsheetSettings) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also