Displaying a Chart in a Grid Template

2 posts, 0 answers
  1. ImNotTed
    ImNotTed avatar
    11 posts
    Member since:
    Oct 2013

    Posted 18 Sep 2015 Link to this post

    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!

  2. ImNotTed
    ImNotTed avatar
    11 posts
    Member since:
    Oct 2013

    Posted 18 Sep 2015 Link to this post

    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.

  3. Kendo UI is VS 2017 Ready
Back to Top