Reputation: 2205
Is it possible to render a kendo control inside a Kendo Template? Something like this one?
<script id="treeview-template" type="text/kendo-ui-template">
@{Html.Kendo().AutoComplete()
.Name("test")
.Render();
}
</script>
Thanks in advance!
Upvotes: 8
Views: 5431
Reputation: 20223
Yes you can, just do not forget to call the ToClientTemplate method at the end. This method should be available for any Kendo widget.
Upvotes: 7
Reputation: 2205
Thanks for the help Pechka! ToClientTemplate() extension method did the job.
<script id="treeview-template" type="text/kendo-ui-template">
# var ctrlid= item.ControlId; #
@(Html.Kendo().AutoComplete()
.Name("#=ctrlid#")
.ToClientTemplate()
)
</script>
But for some reason, when I put "item.ControlId" directly at the name property, it can't render the control. So i tried storing it in a variable and used that on the name property and it worked. :)
Upvotes: 8