This is a migrated thread and some comments may be shown as answers.

Using row Template in server side

1 Answer 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VnDevil
Top achievements
Rank 2
VnDevil asked on 10 Nov 2015, 11:24 AM

Hi Telerik,

 

I'm usingASP.NET MVC Grid and I want using Column Template in server side but it's not working with my code:

<div id="clientsDb">
    @(Html.Kendo().Grid<vw_Products>()
          .Name("grid")
          .Columns(columns =>
          {
              columns.Template(item => "<img class='product-photo' src='" + ImageModel.GetThumbnail(item.Images) + "' alt='" + item.Title + "' /></td>")
                  .Width(140).Title("Picture");
              columns.Bound(c => c.Title).Title("Product Name").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
              columns.Bound(c => c.Price).Title("Price").Width(300).Filterable(ftb => ftb.Cell(cell => cell.Operator("gte")));
          })
          .HtmlAttributes(new { style = "height: 700px;" })
          .Scrollable()
          .Groupable()
          .Sortable()
          .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
          .Pageable(pageable => pageable
              .Refresh(true)
              .PageSizes(pageSizes)
              .ButtonCount(5))
          .DataSource(dataSource => dataSource
              .Ajax()
              .PageSize(30)
              .Read(read => read.Action("Products_Read", "Home"))
          )
    )
</div>

I think my set up is ok but it's not working, the column Template is Empty plz help me. Thanks

columns.Template(item => "<img class='product-photo' src='" + ImageModel.GetThumbnail(item.Images) + "' alt='" + item.Title + "' /></td>")

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 11 Nov 2015, 10:15 AM
Hello,

If the grid is ajax bound use the ClientTemplate method. The value should be a string which represents a valid Kendo Template.

You can refer to this help article where more information is provided.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
VnDevil
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Share this question
or