Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146629 | Aug 12,2019 12:07 AM UTC | Aug 12,2019 06:53 AM UTC | ASP.NET Core - EJ 2 | 1 |
![]() |
Tags: DataGrid |
<script>
function failure(args) {
var errorMessage = args.error[0].error.responseText.split("Exception:")[1].split('<br>')[0]; //extract the message from args
alert(errorMessage);
}
</script>
[Server side code]
public async Task<JsonResult> OnPostInsert([FromBody]SyncfusionControlCrudModel<Keyword> syncfusionControlCrudModel)
{
var keywordText = syncfusionControlCrudModel?.value?.Value?.ToLowerInvariant();
if (string.IsNullOrEmpty(keywordText) || keywordText.Length<4)
{
ModelState.AddModelError(string.Empty, "The keyword text needs to be at least 3 characters");
throw new Exception("The keyword text needs to be at least 3 characters "); //Add custom exception message
;
}
. . .
return new JsonResult(syncfusionControlCrudModel.value);
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.