[英]Kendo with ASP.Net MVC : Display data in editor template
I have my template (in "EditorTemplates" folder) and I try to display value of my model. 我有我的模板(在“ EditorTemplates”文件夹中),并且尝试显示模型的值。
To display in an input, I do : 要显示在输入中,我这样做:
<input type="text" name="MyValue" data-bind="value:MyValue" />
But what if I just want to display one of values with Kendo, without an input field ? 但是,如果我只想用Kendo显示一个值而没有输入字段怎么办?
EDIT : 编辑:
For example, in the pure javascript kendo usage (without MVC helpers), you could do that with templates : 例如,在纯JavaScript kendo用法中(没有MVC帮助器),您可以使用模板来做到这一点:
<script id="javascriptTemplate" type="text/x-kendo-template">
<p>
#= myCustomVariable #
</p>
</script>
Or with algorithms: 或搭配演算法:
<script id="javascriptTemplate" type="text/x-kendo-template">
<ul>
# for (var i = 0; i < data.length; i++) { #
<li>#= data[i] #</li>
# } #
</ul>
</script>
How can I do that with kendo MVC templates ? 如何使用Kendo MVC模板做到这一点?
To display a value it is a similar concept to the input's. 要显示一个值,它与输入的概念相似。
Something like this: 像这样:
<span data-bind="text:yourValue"></span>
obviously you can change the html tag to your needs. 显然,您可以根据需要更改html标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.