Notifications
JavaScript
FD.Page.showErrorCallback = function (data, event) { notify.alert('Client Side Error.'); }; FD.Page.showWarningCallback = function (data, event) { notify.info('Client Side Warning.'); }; FD.Page.showPersistentWarningCallback = function (data, event) { notify.info('Persistent Client Side Warning.', true); };
Automatic $.fdAjax Error
JavaScript
FD.Page.handleMakeError = function (data, event) { $.fdAjax({ url: baseUrl + "MakeError", callback: function (result) { if (!result.data) { // Do error cleanup here } } }); } FD.Page.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">Button</a> <a class="btn btn-secondary" data-fd-control="button" asp-action="MakException">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."); }