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

Displaying a Chart in a Grid Template

1 Answer 90 Views
Templates
This is a migrated thread and some comments may be shown as answers.
ImNotTed
Top achievements
Rank 1
Iron
ImNotTed asked on 18 Sep 2015, 04:18 PM

Greetings,

I have a grid which displays a ClientDetailTemplateId for additional details that won't fit horizontally on the page. I'm trying to wire-up a Kendo chart into that template, but I am receiving "Invalid template" errors. I was hoping someone could help me fix this up.

 

The template looks something like this:

@using Inventory.Models.Reservation
 
<script id="​reservedAmountsTemplate" type="text/kendo-tmpl">
@(Html.Kendo().Chart<ReservedAmountsViewModel>()
    .Name("chart_#=ReservationId#")
    .Title(title => title
      .Text("​Title!")
      .Position(ChartTitlePosition.Bottom))
    .Series(series =>
    {
      series.Pie(new dynamic[]
      {
        new {category = "​Test1", value = 53.8},
        new {category = "​Test2", value = 16.1},
      });
    })
    )
</script>

The error is your standard "Unhandled exception at line 9, column 7418 in http://localhost:9244/Scripts/kendo/2015.2.805/kendo.all.min.js
0x800a139e - JavaScript runtime error: Invalid template".

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
ImNotTed
Top achievements
Rank 1
Iron
answered on 18 Sep 2015, 04:35 PM

Ok, I figured it out. Been scratching my head on this all morning. Then I just remembered about the "ToClientTemplate()" method.

 

Everything's good now.

Tags
Templates
Asked by
ImNotTed
Top achievements
Rank 1
Iron
Answers by
ImNotTed
Top achievements
Rank 1
Iron
Share this question
or