I have a grid. I am using the dialog mode to open a dialog when the user adds or edits an item. When the user clicks save and is returned to the grid I want to display a bootstrap type message that says something like "Success". How do I do that? I do not want to do a javascript alert. Here is my code below:
<div class="inventoryGrid">
@Html.EJS().Grid("InventoryGrid").DataSource(DataManager => { DataManager.Json(@Model.Inventory.ToArray()).InsertUrl("/Home/AddInventoryItem").UpdateUrl("/Home/UpdateInventoryItem").Adaptor("RemoteSaveAdaptor"); }).AllowFiltering(true).AllowSorting(true).Columns(col =>
{
col.Field("InventoryID").HeaderText("Id").IsPrimaryKey(true).IsIdentity(true).AllowEditing(false).Width("40").Add();
col.Field("HECNumber").HeaderText("HEC Number").Visible(false).Add();
}).AllowPaging(true).ActionBegin("actionBegin").ActionComplete("actionComplete").FilterSettings(filter => { filter.Columns(filterColumns).Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).SortSettings(sort => sort.Columns(sortColumns)).PageSettings(page => page.PageSize(15)).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(new List<string>() { "Add", "Edit" }).Render()
</div>
<script>
function booleanAccessorFn(field, data, column) {
var value = data[field];
if (value == true) {
value = "Yes";
} else {
value = "No";
}
return value;
}
function actionBegin(args) {
if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {
for (var i = 0; i < this.columns.length; i++) {
if (this.columns[i].field == "HECNumber" || this.columns[i].field == "CeeUsNumber" || this.columns[i].field == "IsBudgetCharge") {
this.columns[i].visible = true;
}
}
}
if (args.requestType == "save") {
if (args.data['EmployeePrice'] == null) {
args.data['EmployeePrice'] = value;
}
}
}
function actionComplete(args) {
if (args.requestType === 'save') {
for (var i = 0; i < this.columns.length; i++) {
if (this.columns[i].field == "CustomerID") {
this.columns[i].visible = false;
}
}
}
if ((args.requestType === 'beginEdit' || args.requestType === 'add')) {
var dialog = args.dialog;
// change the header of the dialog
dialog.header = args.requestType === 'beginEdit' ? 'Edit Inventory Item' : 'Add Inventory Item';
}
}
</script>
@Html.EJS().ScriptManager()
So When the user saves an item a success message should appear below the words Manage Inventory. Ideally, I want to display a different message based on if the item was edited or added. So if the user adds an item then "Item Added" should be displayed. If the user edits an item then the message should say "Item Updated".