Below is my view containing my ListView as well as my controller. I can successfully edit and save my data client side, but it never calls the update action on my controller and I can't figure out why. I've copied the example from the Editing demo, but can't figure out what I'm missing. Any ideas?
@model IEnumerable<
Announcement
>
@{
Layout = "~/Views/Shared/_Kendo.cshtml";
}
<link rel="stylesheet" href="~/lib/kendo-ui-core/css/web/kendo.common.min.css" />
<link rel="stylesheet" href="~/lib/kendo-ui-core/css/web/kendo.default.min.css" />
<script src="~/lib/kendo-ui-core/js/jquery.min.js"></script>
<script src="~/lib/kendo-ui-core/js/kendo.all.min.js"></script>
<script src="~/lib/kendo-ui-core/js/kendo.aspnetmvc.min.js"></script>
<link rel="stylesheet" href="~/lib/kendo-ui-core/css/web/kendo.default.min.css" />
<script src="~/lib/kendo-ui-core/js/jquery.min.js"></script>
<script src="~/lib/kendo-ui-core/js/kendo.all.min.js"></script>
<script src="~/lib/kendo-ui-core/js/kendo.aspnetmvc.min.js"></script>
@(Html.Kendo().ListView<
Announcement
>(Model)
.Name("listView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id("Id"))
.Read(read => read.Action("Index_Read", "ListView"))
.Update(update => update.Action("Index_Update", "ListView"))
)
.Editable()
)
<
script
type
=
"text/x-kendo-tmpl"
id
=
"template"
>
<
div
class
=
"form-group"
>
<
h4
>#:Category#</
h4
>
#:Description#
<
div
class
=
"text-right"
>
<
a
class
=
"btn btn-xs btn-primary k-edit-button"
href
=
"\\#"
>Edit</
a
>
<
a
class
=
"btn btn-xs btn-primary k-delete-button"
href
=
"\\#"
>Delete</
a
>
</
div
>
</
div
>
</
script
>
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using My.BO;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
namespace Web.Controllers
{
public class KendoController : Controller
{
// GET: /<
controller
>/
public IActionResult Index()
{
var model = GetAnnouncements();
return View(model);
}
public ActionResult Index_Read([DataSourceRequest] DataSourceRequest request)
{
return Json(GetAnnouncements().ToDataSourceResult(request));
}
[AcceptVerbs("Post")]
public ActionResult Index_Update([DataSourceRequest] DataSourceRequest request, Announcement announcement)
{
if (announcement != null && ModelState.IsValid)
{
//_service.UpdateHotTopic(topic);
}
return Json(ModelState.ToDataSourceResult());
}
private List<
Announcement
> GetAnnouncements()
{
return new List<
Announcement
>() {
new Announcement()
{
Id = 1,
Category = "Test 1",
Description = "Test 1"
},
new Announcement()
{
Id = 2,
Category = "Test 2",
Description = "Test 2"
}
};
}
}
}