MVC helper inside template

I'm trying to use the kendo MVC helper inside the template (the remote template file is downloaded as: http://docs.kendoui.com/howto/load-templates-external-files#remote-templates . I have a controller that sends the generated markup to the client)

My template file looks something like this:

<script id="my-pager-template" type="text/x-kendo-template">
    My pager

    @(Html.Kendo().ListView<Business.Data.MyPage>()
        .Name("myPagerListView")
        .TagName("div")
        .ClientTemplateId("my-pager-item-template")
        .DataSource(dataSource => dataSource.Read(read => 
            read.Action("GetMyPages","Page")
            )
        ).ToClientTemplate())

</script>

<script id="my-pager-item-template" type="text/x-kendo-template" >
    <div class="k-button" data-pager-item-pageid="${PageID}" data-pager-item-pagename="${Name}">
        <span>${ButtonText}</span>
    </div>
</script>

But the markup created gives me Uncaught SyntaxError: Unexpected token <in my browser console (chrome).

The markup created by the assistant is as follows:

<div id="myPagerListView"></div>
<script>
    jQuery(function(){jQuery("\#myPagerListView").kendoListView({"dataSource":{"transport":{"prefix":"","read":{"url":"/Page/GetMyPages"}},"serverPaging":true,"serverSorting":true,"serverFiltering":true,"serverGrouping":true,"serverAggregates":true,"type":"aspnetmvc-ajax","filter":[],"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"fields":{"PageID":{"type":"number"},"Name":{"type":"string"},"ButtonText":{"type":"string"}}}}},"template":kendo.template($('\#my-pager-item-template').html())});});
<\/script>

</script>

Can I use kendo helpers this way? (This post says it can be used: Can I use the Kendo MVC helpers inside the templates? )

+4
2

, , - , kendo , read.Action("GetMyPages","Page"), , , HTML- json, - "<html ....", , url chrome, , json

http://yourdomain.com/Pages/GetPages/ ( ), , HTML-

0

. ( 3 :(), , ajax, jquery html jquery, , , kendo.
( script ).
Fortunatly, kendo. . .
, .

, .

0

All Articles