我试图在Kendo UI模板中找出列表视图,如何遍历每个对象中的集合以在页面上呈现信息.这是我正在玩的json的一个例子:
{"Data":[{"Title":"Malicious Acts","KeyPairs":{"Key1":"12","Key2":"24"}}, {"Title":"Enrollments","KeyPairs":{"Key1":"12","Key2":"24"}},{"Title":"Customer Feedback","KeyPairs":{"Key1":"12","Key2":"24"}},{"Title":"Questionable Accounts","KeyPairs":{"Key1":"12","Key2":"24"}}],"Total":4,"AggregateResults":null,"Errors":null}
Run Code Online (Sandbox Code Playgroud)
我想在模板中渲染KeyPairs项目,只是在理解如何操作时遇到一些麻烦.
这是来源:
<div id="subscriberFunctions">
<script type="text/x-kendo-tmpl" id="template">
<div class="subscriberFunction">
<h3>${Title}</h3>
<!-- Display KeyPairs -->
</div>
</script>
@(Html.Kendo().ListView<SubscriberMenuFunction>()
.Name("listView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("SubscriberMenu", "ListView"));
})
.Selectable(selectable => selectable.Mode(ListViewSelectionMode.Single))
)
</div>
Run Code Online (Sandbox Code Playgroud)
我敢肯定我只是在思考这个问题,而且它是一种简单化的东西,但不确定如何在模板中实现foreach循环以便Kendo UI识别它.
提前致谢!
查看内容编辑器将基于模板创建新内容项的方案.换句话说,如果我根据汽车模板创建一个内容项,我想在新的汽车项目下添加一个名为"选项"的文件夹.
作为内容编辑器,我可以从文件夹上的insert命令添加各种选项.
可以这样做,如果是这样的话怎么办?
遇到奇怪的Sitecore错误.使用MVC将Sitecore 6.6中的布局应用于几个不同的内容项,我收到此错误:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App_Web__sitecorelayout.cshtml.5d96958d.682ppzj_.0.cs(24): error CS0234: The type or namespace name 'Kernel' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
System.Web.HttpCompileException (0x80004005): c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App_Web__sitecorelayout.cshtml.5d96958d.682ppzj_.0.cs(24): error CS0234: The type or namespace name 'Kernel' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean …Run Code Online (Sandbox Code Playgroud)