This question is locked. New answers and comments are not allowed.
When exactly does the onError event fire for the grid?
I want to know if what I have is sufficient for any errors that occur in my Controller. In my .Layout_cshtml page, I have the below code snippet...
I want to make sure that if an error occurs inside the Catch block, it will display (via the code in the _Layout.cshtml page).
In my controller, inside the Catch, I don't have anything.
What if I have an error with the Model? Will this automatically display as is or do I need to capture the ModelState error (which I know how to do) in the Controller and spit out an alert message here....
In my View, I have the followng:
.Layout_cshtml page:
I want to know if what I have is sufficient for any errors that occur in my Controller. In my .Layout_cshtml page, I have the below code snippet...
I want to make sure that if an error occurs inside the Catch block, it will display (via the code in the _Layout.cshtml page).
In my controller, inside the Catch, I don't have anything.
What if I have an error with the Model? Will this automatically display as is or do I need to capture the ModelState error (which I know how to do) in the Controller and spit out an alert message here....
In my View, I have the followng:
.ClientEvents(ev => ev.OnError("error_handler"))
.Layout_cshtml page:
<
script
type
=
"text/javascript"
>
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
</
script
>