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

Invalid tempate

1 Answer 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Timothy
Top achievements
Rank 1
Timothy asked on 22 Jul 2012, 09:26 AM
What does this mean:-
Unhandled exception at line 1, column 5227 in http://localhost:41728/Scripts/kendo.web.min.js

0x800a139e - JavaScript runtime error: Invalid template:'

I have pruned back my page to what I can see in the samples and still get this error.

@model IEnumerable<PlumSoftware.Models.Sales_Invoice>

@(Html.Kendo()
      .Grid(Model)
      .Name("Sales_Invoices")
      .Columns(columns =>
      {
         columns.Bound(c => c.NUM).Width(70);
         columns.Bound(c => c.Description).Width(200);
         columns.Bound(c => c.AC).Width(200);
         columns.Bound(c => c.NETT).Width(70);
         columns.Bound(c => c.GST).Width(70);
      })
      .ClientDetailTemplateId("worktemplate")
      .Pageable()
      .DataSource(dataBinding => dataBinding
                                            .Ajax()
                                            .PageSize(10)
                                            .Read(read => read.Action("Work_InvoicesRead", "Admin"))
                                            )
      .Sortable()
)

<script id="worktemplate" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<PlumSoftware.Models.Sales_Invoices_Work>()
        .Name("Details_#=SalesInvoiceID#")
        .Columns(columns =>
        {
            columns.Bound(m => m.ID);
            columns.Bound(m => m.DATED);
            columns.Bound(m => m.Description);
        })        
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Work_DetailsRead", "Admin", new { salesInvoiceID = "#=SalesInvoiceID#" }))
        )
        .Pageable()
        .Sortable()   
        .ToClientTemplate()
    )
</script>

The exception looks like:-
    <div class="k-widget&#32;k-grid" id="Details_2"><table cellspacing="0"><colgroup><col /><col /><col /></colgroup><thead class="k-grid-header"><tr><th class="k-header" data-field="ID" data-title="ID" scope="col"><a class="k-link" href="/Admin/Work_DetailsRead?salesInvoiceID=2&amp;Details_2-sort=ID-asc">ID</a></th><th class="k-header" data-field="DATED" data-title="DATED" scope="col"><a class="k-link" href="/Admin/Work_DetailsRead?salesInvoiceID=2&amp;Details_2-sort=DATED-asc">DATED</a></th><th class="k-header" data-field="Description" data-title="Description" scope="col"><a class="k-link" href="/Admin/Work_DetailsRead?salesInvoiceID=2&amp;Details_2-sort=Description-asc">Description</a></th></tr></thead><tbody><tr class="t-no-data"><td colspan="3"></td></tr></tbody></table><div class="k-pager-wrap&#32;k-grid-pager"><a class="k-link&#32;k-state-disabled" data-page="1" href="\#" title="Go&#32;to&#32;the&#32;first&#32;page"><span class="k-icon&#32;k-i-seek-w">seek-w</span></a><a class="k-link&#32;k-state-disabled" data-page="0" href="\#" title="Go&#32;to&#32;the&#32;previous&#32;page"><span class="k-icon&#32;k-i-arrow-w">arrow-w</span></a><ul class="k-pager-numbers&#32;k-reset"><li><span class="k-state-selected" data-page="1">1</span></li></ul><a class="k-link&#32;k-state-disabled" data-page="2" href="\#" title="Go&#32;to&#32;the&#32;next&#32;page"><span class="k-icon&#32;k-i-arrow-e">arrow-e</span></a><a class="k-link&#32;k-state-disabled" data-page="1" href="\#" title="Go&#32;to&#32;the&#32;last&#32;page"><span class="k-icon&#32;k-i-seek-e">seek-e</span></a><span class="k-pager-info&#32;k-label">0 - 0 of 0 items</span></div></div><script>

    jQuery(function(){jQuery("\#Details_2").kendoGrid({columns:[{title:"ID",field:"ID",encoded:true},{title:"DATED",field:"DATED",encoded:true},{title:"Description",field:"Description",encoded:true}],pageable:{},sortable:true,scrollable:false,dataSource:{transport:{read:{url:"/Admin/Work_DetailsRead?salesInvoiceID=2"}},pageSize:10,page:1,total:0,serverPaging:true,serverSorting:true,serverFiltering:true,serverGrouping:true,serverAggregates:true,type:"aspnetmvc-ajax",filter:[],schema:{data:"Data",total:"Total",errors:"Errors",model:{fields:{ID:{type:"number"},SalesInvoiceID:{type:"number"},INVOICE:{type:"number"},DATED:{type:"date"},CustomerRequestID:{type:"number",defaultValue:null},ActivityCodeID:{type:"number"},Employee:{type:"number"},Description:{type:"string"},HOURS:{type:"number"},RATE:{type:"number"},TOTAL:{type:"number"}}}}}});});

<\/script>

' Generated code:'var o,e=kendo.htmlEncode;with(data){o='\n    <div class="k-widget&';32;k-grid" id="Details_2"><table cellspacing="0"><colgroup><col /><col /><col /></colgroup><thead class="k-grid-header"><tr><th class="k-header" data-field="ID" data-title="ID" scope="col"><a class="k-link" href="/Admin/Work_DetailsRead?salesInvoiceID=2&amp;Details_2-sort=ID-asc">ID</a></th><th class="k-header" data-field="DATED" data-title="DATED" scope="col"><a class="k-link" href="/Admin/Work_DetailsRead?salesInvoiceID=2&amp;Details_2-sort=DATED-asc">DATED</a></th><th class="k-header" data-field="Description" data-title="Description" scope="col"><a class="k-link" href="/Admin/Work_DetailsRead?salesInvoiceID=2&amp;Details_2-sort=Description-asc">Description</a></th></tr></thead><tbody><tr class="t-no-data"><td colspan="3"></td></tr></tbody></table><div class="k-pager-wrap&;o+='32;k-grid-pager"><a class="k-link&';32;k-state-disabled" data-page="1" href="#" title="Go&;o+='32;to&';32;the&;o+='32;first&';32;page"><span class="k-icon&;o+='32;k-i-seek-w">seek-w</span></a><a class="k-link&';32;k-state-disabled" data-page="0" href="#" title="Go&;o+='32;to&';32;the&;o+='32;previous&';32;page"><span class="k-icon&;o+='32;k-i-arrow-w">arrow-w</span></a><ul class="k-pager-numbers&';32;k-reset"><li><span class="k-state-selected" data-page="1">1</span></li></ul><a class="k-link&;o+='32;k-state-disabled" data-page="2" href="#" title="Go&';32;to&;o+='32;the&';32;next&;o+='32;page"><span class="k-icon&';32;k-i-arrow-e">arrow-e</span></a><a class="k-link&;o+='32;k-state-disabled" data-page="1" href="#" title="Go&';32;to&;o+='32;the&';32;last&;o+='32;page"><span class="k-icon&';32;k-i-seek-e">seek-e</span></a><span class="k-pager-info&;o+='32;k-label">0 - 0 of 0 items</span></div></div><script>\n\tjQuery(function(){jQuery("#Details_2").kendoGrid({columns:[{title:"ID",field:"ID",encoded:true},{title:"DATED",field:"DATED",encoded:true},{title:"Description",field:"Description",encoded:true}],pageable:{},sortable:true,scrollable:false,dataSource:{transport:{read:{url:"/Admin/Work_DetailsRead?salesInvoiceID=2"}},pageSize:10,page:1,total:0,serverPaging:true,serverSorting:true,serverFiltering:true,serverGrouping:true,serverAggregates:true,type:"aspnetmvc-ajax",filter:[],schema:{data:"Data",total:"Total",errors:"Errors",model:{fields:{ID:{type:"number"},SalesInvoiceID:{type:"number"},INVOICE:{type:"number"},DATED:{type:"date"},CustomerRequestID:{type:"number",defaultValue:null},ActivityCodeID:{type:"number"},Employee:{type:"number"},Description:{type:"string"},HOURS:{type:"number"},RATE:{type:"number"},TOTAL:{type:"number"}}}}}});});\n<\/script>\n';}return o;'

As you can see from the generated code the &#32; has been incorrectly updated to &';32;
which is causing the problem.
The environment is Windows 8 Release Preview; Visual Studio 2012 Release Preview; ASP.NET 4.5 RC; MVC 4 RC

If I have time I'll test it on a Windows 7, Visual Studio 2010 SP1; ASP.NET  4; MVC 4 RC to see whether it is an ASP.NET 4.5 issue.

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 23 Jul 2012, 08:38 AM
Hello Timothy,

The error seems to be related on how templates of for details are generated. Unfortunately we weren't able to replicate it. Can you send use runnable app that demonstrates the error?

Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Timothy
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or