How to show html in grid client detail template

1 Answer 162 Views
Grid
kva
Top achievements
Rank 2
Iron
Iron
Iron
kva asked on 17 Jul 2023, 07:39 AM

My template is

```

<script id="template" type="text/kendo-impl">
<div>
<partial name="EditorTemplates/WorkingEmployeeEditorTemplate"/>
<div style="margin: 15px; display: inline-block;">
@(Html.Kendo().Button()
.Name("createButton")
.Content("Add")
// .Events(e => { e.Click("create"); })
)
</div>
</div>
</script>

```

It should have the dropdown and button in one row. When I rerun the page with this template, the grid disappears.

1 Answer, 1 is accepted

Sort by
1
Accepted
Alexander
Telerik team
answered on 19 Jul 2023, 04:36 PM

Hi,

Generally, when the conventional HTML Helpers are utilized within the boundaries of an external template the component's respective ".ToClientTemplate()" method needs to be declared as well. For example:

<script type="text/kendo" id="OrdersTemplate">
<div>
...
<div style="margin: 15px; display: inline-block;">
@(Html.Kendo().Button()
.Name("createButton")
.Content("Add")
.ToClientTemplate()
 )
</div>
</div>
</script>

In addition, I also noticed that you are trying to load a partial view as well. In this regard, I would recommend utilizing the Html.PartialAsync() Helper extension instead:

<script type="text/kendo" id="OrdersTemplate">
<div>
@await Html.PartialAsync("EditorTemplates/WorkingEmployeeEditorTemplate")
<div style="margin: 15px; display: inline-block;">
@(Html.Kendo().Button()
.Name("createButton")
.Content("Add")
.ToClientTemplate()
 )
</div>
</div>
</script>

For your convenience, I am also attaching a runnable sample that tackles an identical scenario as yours.

Lastly, I noticed that there is no active license associated with your account which limits our support service. Hence, I would recommend renewing your license in order to get a hold of all the latest bug fixes, features, and support services the product provides.

A list of the available support plans can be found here:

I hope the aforementioned information helps.

Kind Regards,
Alexander
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
Grid
Asked by
kva
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Alexander
Telerik team
Share this question
or