【发布时间】:2015-10-01 15:32:58
【问题描述】:
我在 mvc c# kendo ui 网格中遇到了麻烦。我正在尝试从剑道更新批量更新方法调用控制器操作我遇到问题我的 mvc 视图是这样的。它在调用“读取”时工作正常,但是在更新(保存所有批处理)时它没有在控制器中命中:
@(Html.Kendo().Grid(Model.oldList)
.Name("grid")
.Columns(columns =>
{
columns.Bound(m => m.IsNewString).HeaderHtmlAttributes(new { style = "text-align:center;" }).Title("Data").Encoded(false).Width(80); ;
columns.Bound(m => m.Id).HeaderHtmlAttributes(new { style = "text-align:center;" }).Title("Code").Encoded(false).Width(80);
columns.Bound(m => m.Name).HeaderHtmlAttributes(new { style = "text-align:center;" }).Title("Business Name").Encoded(false).Width(80);
columns.Bound(m => m.Address.Address1).HeaderHtmlAttributes(new { style = "text-align:center;" }).Title("Address1").Encoded(false).Width(80);
columns.Bound(m => m.Address.Address2).HeaderHtmlAttributes(new { style = "text-align:center;" }).Title("Address2").Encoded(false).Width(80);
columns.Bound(m => m.Address.Country).HeaderHtmlAttributes(new { style = "text-align:center;" }).Title("Country").Encoded(false).Width(80);
columns.Command(commands =>
{
commands.Destroy();
}).Title("Commands").Width(200);
})
.ToolBar(toolbar =>
{
//toolbar.Create();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource =>
dataSource.Ajax()
.Batch(true) // Enable batch updates
.Model(model =>
{
model.Id(m => m.Id);
model.Field(m => m.Id).Editable(false);
})
//.Create(create => create.Action("Products_Create", "Home"))
.Read(read => read.Action("LoadCompareList", "Home", new { clientId = clientid, templateId = templateid }))
.Update(update => update.Action("test", "Home"))
)
.Pageable()
)
我的控制器动作是这样的:
[HttpPost]
public ActionResult test([DataSourceRequest]DataSourceRequest request,IEnumerable<DetailsDTO> products)
{
return View();
}
但是这个动作没有触发。我不知道发生了什么。
【问题讨论】:
标签: c# asp.net-mvc kendo-ui kendo-grid