user1032957
user1032957

Reputation: 473

kendo mvc grid with different column settings

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?

Upvotes: 1

Views: 2147

Answers (2)

ckv
ckv

Reputation: 10830

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.

Upvotes: 1

Sebastian Wąsik
Sebastian Wąsik

Reputation: 65

try to use custom command........ http://demos.kendoui.com/web/grid/custom-command.html

Upvotes: 0

Related Questions