1
votes

I have a kendo mvc grid which is basically like this:

@(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()
)

Now, Im trying to insert a new column with button(on each row). Each button when clicked fires an event which passes player name to a controller. I have tried using col.Template() after the fourth column. But, no luck with that. Is there any way to do this?

2

2 Answers

1
votes

I used this way to achieve this.

{
                    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>"
                }

I am not using htmlhelpers though.