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

How can I include HTML from my model into a listview via the template?

2 Answers 97 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 14 Mar 2013, 01:01 PM
@* Html contains html string from model *@

<script id="news-item-template" type="text/x-kendo-template">
    <div class="wrapper">
        <figure class="img-indent indent-top1 img-indent-none-mp">
            <img src="${imgPath}" alt="" />
        </figure>
        <div class="extra-wrap clear-ml">
                ${Html}
        </div>
        <div class="edit-buttons">
            <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span>Edit</a>
            <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span>Delete</a>
        </div>
    </div>
</script>

    <div class="container_12">
        <div class="wrapper">
            <div class="grid_7 left">
                <div class="box">
                <h3>Latest News</h3>

                    <div class="k-toolbar k-grid-toolbar">
                        <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a>
                    </div>

                    @(Html.Kendo().ListView<MyClub.Models.xtbl_NewsItem>(Model)
                        .Name("listView")
                        .TagName("div")
                        .ClientTemplateId("news-item-template")
                        .DataSource(dataSource => dataSource
                            .Model(model => model.Id("Id"))
                            .PageSize(3)
                            .Create(create => create.Action("NewsCreate", "Home"))
                            .Read(read => read.Action("NewsRead", "Home"))
                            .Update(update => update.Action("NewsUpdate", "Home"))
                            .Destroy(destroy => destroy.Action("NewsDestroy", "Home"))
                        )
                        .Pageable()    
                        .Editable()
                    )

                </div>
            </div>
        </div>
    </div>


2 Answers, 1 is accepted

Sort by
0
Accepted
Mark
Top achievements
Rank 1
answered on 14 Mar 2013, 01:38 PM
<div class="extra-wrap clear-ml">
          #= Html #
</div>

0
Dimiter Madjarov
Telerik team
answered on 18 Mar 2013, 08:12 AM
Hi Mark,


I am glad to hear that you solved the problem. If you need additional resources, you could take a look at our Template demos or the following pages from the documentation:

Kendo UI Templates Overview
Load Templates From External Files

Wish you a great day! 

Regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or