【问题标题】:Kendo grid URL with html.actionlink带有 html.actionlink 的剑道网格 URL
【发布时间】:2018-11-11 02:50:51
【问题描述】:

我正在尝试从 Kendo 网格行调用控制器动作 MVC。 以下是专栏

{
    field: "FileName", title: "Link2", width: "20%",
    template: "@Html.ActionLink('#=FileName', nameof(MeterFactorController.Document), new { Id = #=FileLocator }) )"           
},

它显示为字符串而不是 URL。

【问题讨论】:

  • 您有一个带有文件名的操作?无论如何,你不能那样在 razor/c# 中使用 javascript 变量。

标签: asp.net-mvc kendo-ui grid


【解决方案1】:

如果你想通过调用Controller方法将用户带到不同的视图,你可以试试这个:

template: "<a href='" + controllerUri + "/" + parameters + "'>" + Name of the link + "</a>"

如果您想对控制器进行 Ajax 调用,您可以尝试以下操作:

template: "<a class='k-button' onclick='yourJSFunctionName(event,#=FileName#)'>Your Button Text</a>"

JS:

function yourJSFunctionName(event,FileName) {
    //Ajax call to the controller
    alert("Ajax call");
}

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-17
    相关资源
    最近更新 更多