1

我有一个基本上是这样的 kendo mvc 网格:

@(Html.Kendo().Grid<baseballViewModel>()
      .Name("baseball")
      .DataSource(dataSource => dataSource 
          .Ajax() 
          .Read(read => read.Action("Index", "baseball"))
          .ServerOperation(false)
          )
      .HtmlAttributes(new { style = "height:175px;" })
      .Columns(col => {
              col.Bound(player=> player.Date).Width(85);
              col.Bound(player=> player.Year).Width(55);
              col.Bound(player=> player.Name).Width(150);
              col.Bound(player=> player.team).Width(120);

      }).Sortable() 
        .Scrollable()
        .Pageable()
)

现在,我试图插入一个带有按钮的新列(在每一行上)。单击每个按钮时都会触发一个事件,该事件将玩家名称传递给控制器​​。我尝试在第四列之后使用 col.Template()。但是,没有运气。有没有办法做到这一点?

4

2 回答 2

1

我用这种方式来实现这一点。

{
                    field: "Image", title: "@Application.Instance.Strings.Event_Grid_More", width: "60px", template: "<img src='/Content/Themes/Default/images/Door.png' onclick='showDetails()' id='door' width='20' height='20'/><div id='cardholderdetails' class='popup'></div>"
                }

我没有使用 htmlhelpers。

于 2013-08-14T06:31:18.073 回答
0

尝试使用自定义命令............ http://demos.kendoui.c​​om/web/grid/ custom-command.html

于 2013-08-14T06:28:59.337 回答