我想为 ListView 创建一个自定义模板(我在 ListView 中显示产品 eShop)。我写了这段代码:
<script type="text/x-kendo-tmpl" id="template">
<div class="item">
<div class="image">
<a href='@Url.Action("GetDetails", "Products", routeValues: new {id =${ProductID}} )' target='_blank' class='pimg'>
<img src="${ProductThumbnailImageUrl}" alt=" ${ProductTitle}"/>
</a>
<div class="price"> ${kendo.toString(ProductPrice, "n0")} </div>
<div class="name">
</div>
<div class="description_featured" style="min-height: 110px;">
${ProductDescription}
</div>
</div>
</div>
</script>
@(Html.Kendo().ListView(Model)
.Name("listView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("Products_Read", "Products"));
dataSource.PageSize(12);
dataSource.ServerOperation(false);
})
.Pageable()
)
我收到一个错误new {id = ${ProductTitle}}
。