Can I use Kendo MVC helpers inside templates?

I need to use the Kendo MVC helper Razor code in a template as follows:

<script id="some-reusable-control" type="text/x-kendo-template">
    @(Html.Kendo().Window()
        .Name("details-window"))
</script>

But the problem is that HTML + JS contains the # character (a sharp character), which is displayed as part of the # = # syntax inside the template. Therefore, I get the error "parse error".

<div id="details-window" style="display:none"></div><script>
 jQuery(function(){jQuery("#details-window
").kendoWindow({animation:false,modal:true,draggable:true /*, etc */ });});
</script>

Can someone please provide me a solution on how to use Kendo helpers in templates.

+2
source share
1 answer

To use Kendo UI's Widgets as the content for the template, you can use the ToClientTemplate method. eg.

<script id="some-reusable-control" type="text/x-kendo-template">
  @(Html.Kendo().Window()
      .Name("details-window")
      .ToClientTemplate())
</script>
+8
source

All Articles