- Home
- Forum
- ASP.NET MVC - EJ 2
- Custom confirm message
Custom confirm message
Hi,
I tried to use this code, but begin event not firing and not return custom message.
I noted that editing mode of example is normal, instead I use Dialog.
This is grid:
@(Html.EJS().Grid<AziendeTrasportatriciVM>("GridAziendeTrasportatrici").DataSource(dataManager => { dataManager.Json(((IEnumerable<AziendeTrasportatriciVM>)Model).ToArray()).InsertUrl("InsAziendeTrasportatrici").UpdateUrl("UpdAziendeTrasportatrici").RemoveUrl("DelAziendeTrasportatrici").Adaptor("RemoteSaveAdaptor"); }).Load("load").ActionBegin("begin").ToolbarClick("toolbarClick").ActionComplete("actionComplete").ActionFailure("gridFailure").Columns(col =>
{
col.Field("IdAziendaTrasportatrice").IsPrimaryKey(true).Visible(false).Add();
col.Field("RagioneSociale").AutoFit(true).Add();
col.Field("Indirizzo").AutoFit(true).Add();
col.Field("CAP").AutoFit(true).Add();
col.Field("Citta").AutoFit(true).Add();
col.Field("Email").AutoFit(true).Add();
col.Field("Telefono").AutoFit(true).Add();
}).AllowPaging().PageSettings(page => page.PageSizes(true)).AllowSorting().EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).ShowDeleteConfirmDialog(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(new List<string>() { "Add","Edit","Delete", "Print", "Search" }).Render())
This is script:
function begin(args) {
if (args.requestType == "save" || args.requestType == "delete") {
var grid = document.getElementById("GridAziendeTrasportatrici").ej2_instances[0];
var deleteMessage = '@BloomApp_WEB.Resources.AziendeTrasportatrici.DeleteConfirm';
if (isupdate && args.requestType == "delete") {
if (confirm(deleteMessage)) {
//if yes ,record will delete
}
else
args.cancel = true // if no the record wont delete
}
isupdate = false
}
}
function toolbarClick(args) {
var grid = document.getElementById("GridAziendeTrasportatrici").ej2_instances[0];
if (args.item.properties.prefixIcon == "e-delete") {
isupdate = true
}
}
- Let us know from where you are retrieving the custom error message. Are you getting this message from a server request? If so, we would like to let you know that Grid actions are synchronous and hence will not wait for any async calls. So please confirm us if this is your use case based on which we will provide the further details.
- Please confirm us if your reported problem is the actionBegin event is not triggered or if the delete action is not waiting for custom error message.
- Syncfusion package version used.
- Pictorial or video demonstration of the problem to understand it better.
- If possible share us a simple sample to replicate the problem or try reproducing it in the above shared sample.
Hi Sujith,
thank you for support.
- 3 Replies
- 2 Participants
-
PL Pio Luca Valvona
- Aug 9, 2021 06:48 PM UTC
- Aug 11, 2021 06:03 AM UTC