我可以在模板中使用Kendo MVC帮助器吗? [英] Can I use Kendo MVC helpers inside templates?

查看:65
本文介绍了我可以在模板中使用Kendo MVC帮助器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在模板中使用Kendo MVC帮助器Razor代码,如下所示:

I need to use Kendo MVC helper Razor code in template as listed below:

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

但是呈现的问题是HTML + JS包含一个#(尖锐的符号),该符号作为模板内部#=#语法的一部分呈现.所以我收到解析错误".

But the problem is rendered HTML+JS contains a # (sharp symbol) that is rendered as part of #= # syntax inside template. So I getting '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>

任何人都可以向我提供一种如何在模板中使用Kendo帮助器的解决方案.

Could anyone please provide me a solution of how to use Kendo helpers in templates.

推荐答案

要将Kendo UI窗口小部件用作模板的内容,可以使用ToClientTemplate方法. 例如

To use Kendo UI Widgets as content for a template you could use the ToClientTemplate method. e.g.

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

这篇关于我可以在模板中使用Kendo MVC帮助器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆