Kendo Grid Detail template

3 posts, 1 answers
  1. Sundeep Kumar
    Sundeep Kumar avatar
    3 posts
    Member since:
    Jan 2016

    Posted 04 Feb 2016 Link to this post

    Hi,

    I am trying to access the grid column in detail template and it's gives me invalid template.

    The code look's like

    @(Html.Kendo().Grid<MessageViewModel>()
                  .Name("messageGrid")
                  .Columns(columns =>
                  {
                      columns.Bound(e => e.MessageName);
                      columns.Bound(e => e.MessageSentTime);
                      columns.Bound(e => e.Message).Visible(false);
                  })
                  .Sortable()
                  .Pageable()
                  .Scrollable()
                  .Groupable()
                  .ClientDetailTemplateId("template")
                  .HtmlAttributes(new {style = "height:550px;"})
                  .DataSource(dataSource => dataSource
                      .Ajax()
                      .PageSize(25)
                      .Read(read => read.Action("GetMessageGridData", "Home").Data("getGridData"))
                  ))
            <script id="template" type="text/kendo-tmpl">
                @(Html.Kendo().PanelBar()
                              .Name("Panel_#:Id#") // this id is from parent grid.
                              .Items(panelbar =>
                              {
                                  panelbar.Add().Text("#:MessageName#")
                                      .Expanded(false)
                                      .Content("<pre>" + @Html.Raw(Html.Encode("#:Message#")) + "</pre>");
                              }).ToClientTemplate()
                      )

            </script>

     

    Please help me.

     

  2. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2205 posts

    Posted 05 Feb 2016 Link to this post

    Hello Sundeep Kumar,

    I would suggest using the following #= # template syntax, which is used for rendering HTML values.
    E.g.

    <script id="template" type="text/kendo-tmpl">
        @(Html.Kendo().PanelBar()
            .Name("Panel_#= Id #")

    Let me know if this information helps.

    Regards,
    Dimiter Madjarov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Sundeep Kumar
    Sundeep Kumar avatar
    3 posts
    Member since:
    Jan 2016

    Posted 05 Feb 2016 in reply to Dimiter Madjarov Link to this post

    Hi,

    I managed to get this fix yesterday. I did the same solution you mentioned.

    Thanks for the reply.

Back to Top