Well, I can answer my own question now.
This is how I ended up solving this problem:
function saveTerminalRow(e) {
var terminalData = this.dataItem($(e.currentTarget).closest("tr"));
var saveButton = $(e.currentTarget).closest("tr td a.k-grid-Save");
$.ajax({
type: "POST",
url: "@Url.Action("AddTerminalOoSRecordAsync", "Configuration")",
contentType: "application/json",
data: JSON.stringify(terminalData),
success: function (result) {
var title = "", content = "";
if (result[0].TerminalOutOfStateID != undefined && result[0].TerminalOutOfStateID > 0) {
if (!result[0].IsAlreadyInDb) {
title = "Save Success";
content = "New record has been saved.";
}
else {
title = "No new row inserted";
content = "This terminal already exists in Db.";
}
} else {
title = "Save Failed";
content = "Record is not saved.";
}
$("<div></div>").kendoDialog({
closable: false, // hide X
title: title,
content: content,
actions: [{
text: "OK",
action: function (e) {
if (result[0].TerminalOutOfStateID != undefined && result[0].TerminalOutOfStateID > 0) {
saveButton.remove();
}
return true;
},
primary: true
}]
}).data("kendoDialog").open().center();
},
error: function (request, error) {
alert("Record Saving failed.");
}
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…