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

Kendo Grid Detail template

2 Answers 456 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sundeep Kumar
Top achievements
Rank 1
Sundeep Kumar asked on 04 Feb 2016, 04:53 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 05 Feb 2016, 04:24 PM

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
0
Sundeep Kumar
Top achievements
Rank 1
answered on 05 Feb 2016, 04:27 PM

Hi,

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

Thanks for the reply.

Tags
Grid
Asked by
Sundeep Kumar
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Sundeep Kumar
Top achievements
Rank 1
Share this question
or