Asp.net mvc 剑道网格MVC结合了ajax绑定和服务器编辑

Asp.net mvc 剑道网格MVC结合了ajax绑定和服务器编辑,asp.net-mvc,grid,kendo-ui,Asp.net Mvc,Grid,Kendo Ui,有没有办法将ajax绑定和服务器编辑结合起来 我希望当前的操作,如读取、分页、排序和删除,通过ajax请求完成,并通过服务器编辑创建和更新,因为我有一个需要使用整个页面的复杂表单 我尝试在自定义列中插入操作链接,但它说我不能在ajax绑定上使用服务器编辑。是的,当然,通过使用template()和使用剑道客户端模板,这是可能的 客户机模板基本上是在运行时在客户机上执行的JavaScript,因此我们可以传入Kendo UI知道的变量,这些变量将是您的模型属性名称 因此,如果您希望在每一行旁边都有

有没有办法将ajax绑定和服务器编辑结合起来

我希望当前的操作,如读取、分页、排序和删除,通过ajax请求完成,并通过服务器编辑创建和更新,因为我有一个需要使用整个页面的复杂表单


我尝试在自定义列中插入操作链接,但它说我不能在ajax绑定上使用服务器编辑。

是的,当然,通过使用
template()
和使用剑道客户端模板,这是可能的

客户机模板基本上是在运行时在客户机上执行的JavaScript,因此我们可以传入Kendo UI知道的变量,这些变量将是您的模型属性名称

因此,如果您希望在每一行旁边都有一个链接,例如可能链接到详细信息页面,您可以:

#=...# - Evaluates the JavaScript code expression or a string property from the data item and outputs the result in the template.
#...# - Evaluates the JavaScript code expression inside, but doesn't output value.
#:...# - Evaluates the JavaScript code expression or a string property from the data item and outputs the result in the template which is HTML encoeded.
最简单的解决方案/示例添加一个新列,如下所示:

columns.Template(x => null).ClientTemplate(Html.ActionLink("DisplayText", "Edit", new { Id = "id" }).ToHtmlString().Replace("id", "#=ClientPayeeCodeId#"));
我已经创建了一个Html助手来帮助我实现这一点,以便我可以定制Html,集中实施等:

在Razor看来,我有:

columns.Template(x => null).ClientTemplate(Html.KendoActionLink("Foo", "Bar", "This is a Test", "Name",htmlAttributes: null, routeValues: new Dictionary<string, string>() { { "someParameter", "someValue" }, { "someParameter2", "someValue2" } }));
如果您只希望在网格顶部有一个链接,请执行此操作

.ToolBar(toolbar =>
        {
            toolbar.Custom().Action("Create", "SomeController").Text("<span class=\"k-icon k-i-plus\"></span> Create"); 
        })
.ToolBar(ToolBar=>
{
toolbar.Custom().Action(“创建”、“SomeController”).Text(“创建”);
})
.ToolBar(toolbar =>
        {
            toolbar.Custom().Action("Create", "SomeController").Text("<span class=\"k-icon k-i-plus\"></span> Create"); 
        })