我如何可以访问所有属性在一个选项卡中的一把umbraco节点? [英] How can I access all the properties in one tab in an umbraco node?
本文介绍了我如何可以访问所有属性在一个选项卡中的一把umbraco节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法,我可以访问使用C#标签的一把umbraco的方法吗?我通过每一个属性在某个特定的标签,这样我可以显示/隐藏取决于该选项卡中是否有它的内容或不是网站的该部分试图循环。
Is there a way that I can access tabs in umbraco using C#? I am trying to loop through each property in a particular tab so that I can show/hide that section of the website depending on whether that tab has content in it or not.
我已经试过 ContentType.Tab.GetTab();
但是这有一个id,我无法找到一个标签ID的任何位置
I have tried ContentType.Tab.GetTab();
but that takes an id and I can't find a tab id anywhere.
感谢。
推荐答案
您可以使用 getVirtualTabs
方法,则该选项卡内环路的foreach属性
you can use getVirtualTabs
method then loop foreach property inside that tab
Node current = Node.GetCurrent();
DocumentType dt = DocumentType.GetByAlias(current.NodeTypeAlias);
if (dt != null) {
foreach(var tab in dt.getVirtualTabs) { //get all tabs
foreach(var propertyType in tab.PropertyTypes) { //loop through each property inside the Tab
// propertyType.Name
//....write here your code
}
}
}
这篇关于我如何可以访问所有属性在一个选项卡中的一把umbraco节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文