Posted 3 November 2017, 1:45 am EST
Hello. I am trying to add error handling for server-side exceptions to our callbacks, but I cannot seem to return a message to the UI.
I am setting “e.Handled = true;” so that the CallBackStopped event is fired on the client side, but I cannot find how to send an error message. Can someon please let me know how to do this?
We are using: C#, MVC3, Spread 9.4
JavaScript:
sheet.UpdatePostbackData();
sheet.CallBack('Export', true);
and
$('#sheet').bind('CallBackStopped', function (event) {
// how display error from server here?
});
C# controller action:
protected void ButtonCommand(object sender, SpreadCommandEventArgs e, SheetCommands shtCmds)
{
FpSpread spread = (FpSpread)sender;
if (e.CommandName.Equals("Export"))
{
try
{
ExportSheet();
}
catch (Exception ex)
{
e.Handled = true;
// How can I return an error message to the UI?
}
}
}