Halil Ibrahim
Halil Ibrahim

Reputation: 1369

Kendo UI Grid RowTemplate with Action<T> parameter on Razor View Engine

I'm tring to use Kendo UI Grid component and need to create my custom row template. Actually the gird is really awasome and usage is so cool. But some how I could'nt get display my custom row template.

I need the whole model (I mean whole entity object to display aditional data but not display titles for them on column headers, like images of sub-itmes), so I'm trying to use RowTemplate(System.Action<T>) method that passes each entity for each row. For aspx pages, there is an example on their site as below:

<%= Html.Kendo().Grid(Model)
    .RowTemplate(o =>
    {
%>
    <%= o.Name %>
    <%= o.Age %>
    <%
    })
    %>

But how to do this with razor? I couldn't get it. Should I use WriteLiteral or what? How to use Action<T> to display razor templates?

Upvotes: 1

Views: 1973

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30661

In razor you must use a template delegate:

.RowTemplate(@<text>
   <strong>@item.Name</strong>
   <span>@item.Age</span>
</text>);

Upvotes: 2

Related Questions