I am trying to implement editable jqx grid using MVC Tag helpers.
When I read exaples for MVC i see Edit method implemented
[HttpPost]
public bool Edit(string jsonData)
{
SalesEmployee employee = (SalesEmployee)JsonConvert.DeserializeObject(jsonData, typeof(SalesEmployee));
for (int i = 0; i < _context.SalesEmployees.Count; i++)
{
SalesEmployee currentEmployee = _context.SalesEmployees[i];
if (currentEmployee.ID == employee.ID)
{
currentEmployee.FirstName = employee.FirstName;
currentEmployee.LastName = employee.LastName;
currentEmployee.ProductName = employee.ProductName;
currentEmployee.Price = employee.Price;
currentEmployee.Quantity = employee.Quantity;
currentEmployee.Date = employee.Date;
currentEmployee.Available = employee.Available;
return true;
}
}
return false;
}
Is there a way to grid return message when edit method returns false.
As I see grid locally commit edits even if controller return false.
Sometimes it is not possible to do server-side updates, in that case I want to controller return something to GRID so end user can be shure that commit is maded on server side.
Is there a way to subscribe on ajax success and ajax error call for MVC grid.
Or is there a way to return user message or leave cell uncommitted inside grid when update method return false ?