本文介绍了Kendo MVC:向网格添加编辑,删除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有下表:

    @Html.Kendo().Grid(Model).Name("Staff").Columns(x =>
    {
        x.Bound(y => y.StaffId);
        x.Bound(y => y.FirstName);
        x.Bound(y => y.LastName);
        x.Bound(y => y.Email);
        x.Bound(y => y.Phone);
        x.Command(y => y.Custom("Edit").Action("edit", "controller", new { id = ????? }));

    }).Sortable().Scrollable().Pageable(x=> x.PageSizes(true)).Filterable()

如何将与行关联的主键值(在这种情况下为StaffId)传递给对象路由值,类似于通过Visual Studio自动脚手架进行的操作?

How can I pass the primary key value (StaffId in this case) associated to the row to the object route values similar to the way it is done by Visual Studio auto-scaffold?

推荐答案

一遍又一遍地使用网格之后,我终于可以解决问题了.在这里,您去了

After playing with the grid over and over, I could finally solve the problem. Here you go:

x.Bound(y => y.Title).Template(y=> "<a href=\""+y.Title+"\">Click Me</a>")

这篇关于Kendo MVC:向网格添加编辑,删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 01:24