This should be simple
My grid gets the data initially as expected but doesn't do anything when the update button is clicked while adding a new record.
My server code is here.
Any help would be greatly appreciated.
My grid gets the data initially as expected but doesn't do anything when the update button is clicked while adding a new record.
@(Html.Kendo().Grid<
DepartmentViewModel
>()
.Name("DepartmentsGrid")
.ToolBar(t => t.Create().Text("New Department"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Columns(columns =>
{
columns.Bound(d => d.Name);
columns.Bound(d => d.Email);
columns.Bound(d => d.Phone);
columns.Command(c => c.Edit());
}).Filterable().Groupable().Sortable().Pageable()
.DataSource(datasource => datasource
.Ajax()
.Events(events => events.Error("error_handler"))
.Create("CreateDepartment","Admin")
.Update("UpdateDepartment","Admin")
.Model(m=> m.Id(id => id.Id))
.Read(read => read.Action("DepartmentsGridData", "Admin"))))
public partial class AdminController
{
public ActionResult Departments()
{
return View();
}
public ActionResult DepartmentsGridData([DataSourceRequest] DataSourceRequest request)
{
var data = _departmentService.GetDepartments();
var model = data.ToDataSourceResult(request);
return Json(model);
}
[HttpPost]
public ActionResult CreateDepartment([DataSourceRequest] DataSourceRequest request,Department department)
{
return null;
}
[HttpPost]
public ActionResult UpdateDepartment([DataSourceRequest] DataSourceRequest request,Department department)
{
return null;
}
}