通过jqgrid调用MVC中的Controller's Action

Call Controller's Action in MVC through jqgrid

本文关键字:Action Controller jqgrid 调用 MVC 中的 通过      更新时间:2023-09-26

我使用Formatter在jqgrid行中创建了按钮。

现在我尝试通过以下方式调用控制器的Action方法,

{
name: 'Save', index: 'Save', width: 100, sortable: false,
formatter: function (cellvalue, options, rowObject) {
return "input type='button' value='store' onclick=location.href=@Url.Action("Action", "Controller") ";
}
}     

但是,我不能调用这个动作。如何解决这个问题?

变化:

onclick=location.href=@Url.Action("Action", "Controller")

:

onclick=location.href='@Url.Action("Action", "Controller")'