【发布时间】:2012-08-11 00:54:55
【问题描述】:
我有一个用于 MVC 的 Kendo Grid,并且我在每一行都添加了一个自定义命令。现在我需要连接 click 事件以使用所选行中的 ID 值将用户重定向到另一个视图。
按原样工作,但 ID 是硬编码的。我需要动态构建重定向的帮助:
function editShippment() {
var grid = $('#Grid').data('kendoGrid'); //get a reference to the grid data
var record = grid.dataItem(grid.select()); //get a reference to the currently selected row
var shippingHeaderID = record.ShippingHeaderID;
window.location.href = "@Url.Action("ShippingLineItemsEdit","Shipping",new {id= 182})"; //hard coded but need the record.ShippingHeaderID inserted here.
}
【问题讨论】:
-
将自定义命令添加到行的代码在哪里?
-
columns.Command(command => command.Custom("Edit").Click("editShippment")).Width(40);
标签: asp.net-mvc asp.net-mvc-3 razor kendo-ui