如何在Kendo Grid中显示链接或操作列

时间:2015-05-03 08:59:06

标签: kendo-ui kendo-grid

我正在使用Kendo Grid,我想要点击列时的链接。我想要字段:“名称” link.and为链接名称

设置css

这是我的代码:

columns: [
   { field: "Id", title: " id", template: "<a href='http://www.codeproject.com/'>Id</a>" },
   { field: "Name", title: "Product Name" },
   {
     title: "Action",
     template: "<a href='http://www.codeproject.com/'>Edit</a>"
   },

1 个答案:

答案 0 :(得分:0)

为此,您必须在列中设置template

{ 
    field: "Name", 
    title: "Product Name",
    template: "<a href=''>#= Name #</a>"
},

您可以通过向a标记添加类来应用这些样式。

更新

要使用@Html.ActionLink我建议使用此类模板:

<script id="link-template" type="text/x-kendo-template">
    # var link = "@Html.ActionLink("{0}", "Index", "Home")".replace("{0}", Name); #
    #= link #
</script>

然后使用如下:

template: kendo.template($("#link-template").html())

试一试,我没有测试过。

相关问题