Ala*_*her 2 asp.net-mvc razor asp.net-mvc-3 kendo-ui
我有一个用于MVC的Kendo Grid,我已经为每一行添加了一个自定义命令.现在我需要连接click事件,使用所选行的ID值将用户重定向到另一个View.
这是按原样工作,但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.
}
Run Code Online (Sandbox Code Playgroud)
使用Url.Action帮助程序构建主URL,然后附加id.
window.location.href = "@Url.Action("ShippingLineItemsEdit","Shipping")"
+ "/" + shippingHeaderID;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5462 次 |
| 最近记录: |