在umbraco中渲染子文章的LayoutGrid? [英] Render LayoutGrid of child article in umbraco?
本文介绍了在umbraco中渲染子文章的LayoutGrid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一篇文章,女巫有多篇相关文章.此相关文章有一个布局网格.现在,我想在我的主要文章下面呈现此网格. 我通过以下代码获得了这篇相关文章:
I have a article witch has multiple related article. this related articles have a layout grid. now I want to render this grids below of my main article. I get this related article by this code:
@{
var children = Model.Content.GetPropertyValue("relatedArticles").ToString().Split(',');
}
@foreach (var child in children) {
Umbraco.Content(child).GetGridHtml("gridLayout");
}
但是GetGridHtml()函数不起作用.在umbraco文档中 GetGridHtml 只能从@CurrentPage访问. 如何渲染这些网格布局?
but GetGridHtml() function donot work. in umbraco documentation GetGridHtml only is accesible from @CurrentPage. how can I render these grid layout?
推荐答案
我终于使用以下方法找到了解决方案:
I finally found my solution by using this method:
@{
var children = Model.Content.GetPropertyValue("relatedArticles").ToString().Split(',');
}
@foreach (var child in children) {
var data = Umbraco.TypedContent(child);
@Html.GetGridHtml(data, "gridLayout");
}
这篇关于在umbraco中渲染子文章的LayoutGrid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文