Hello
I have a Grid in the ExternalFormTemplate editing mode, with UpdateURL and InsertURL callbacks. How do I show server errors in the ExternalForm template when the callback fails on server?
I have tried an Action like this
public ActionResult CreateCallback(GridItemViewModel value)
{
var err = new {key="Name", errors=new[] {"Name error"}};
var errm = new List<object> { err };
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return new JsonResult
{
Data = errm, JsonRequestBehavior=JsonRequestBehavior.AllowGet
};
}
which correctly triggers ActionFailure event on the client, but, when the ActionFailure event is received, the editing form is already closed.
I have looked at the
https://www.syncfusion.com/kb/6817/how-to-perform-server-side-validation-in-grid
https://www.syncfusion.com/kb/5170/how-to-display-custom-error-message-on-ajax-action-failture
https://www.syncfusion.com/forums/118649/how-to-bind-modelstate-error-to-sync-fusion-grid-for-inline-editing-updating
but I don't want to use separate validation ajax calls, popups/alerts, and I'd rather not build my own HTML to show errors.
So, is it possible to prevent closing the editing form in the case of insert/update error, or, even better, somehow bind the validation errors from the server to the fields in the editing form, something like
@Html.ValidationMessageFor
in the pure MVC?
Thanks, Tom
|
<script>
function failure(args) {
$("#" + this._id + "_externalEdit").css("display", "block");
}
</script> |