Notifications
JavaScript
child.showErrorCallback = function (data, event) { notify.alert('Client Side Error.'); }; child.showWarningCallback = function (data, event) { notify.info('Client Side Warning.'); }; child.showPersistentWarningCallback = function (data, event) { notify.info('Persistent Client Side Warning.', true); };
Automatic $.fdAjax Error
JavaScript
child.handleMakeError = function (data, event) { $.fdAjax({ url: baseUrl + "MakeError", callback: function (result) { if (!result.data) { // Do error cleanup here } } }); } child.handleMakeException = function (data, event) { $.fdAjax({ url: baseUrl + "MakeException", callback: function (result) { if (!result.data) { // Do error cleanup here } } }); }
C#
public IActionResult MakeError() { return Error("This is a server side error message."); } public IActionResult MakeError() { return Error("This is a server side error message."); }
Automatic Unobtrusive Ajax Error
This also works on forms and has other data-ajax calbacks.
HTML
<div class="btn-group"> <a class="btn btn-primary" data-fd-control="button" asp-action="MakeError" data-ajax="true" data-ajax-failure="FD.Utility.onFailure">Button</a> <a class="btn btn-secondary" data-fd-control="button" asp-action="MakException" data-ajax="true" data-ajax-failure="FD.Utility.onFailure">Button</a> </div>
C#
public IActionResult MakeError() { return Error("This is a server side error message."); } public IActionResult MakeError() { return Error("This is a server side error message."); }