我正在Sitecore 7.1
使用MVC
.
我需要获取用于特定 Sitecore 项目的子布局或渲染的项目 ID。有没有办法我使用.net 获取站点核心中的项目使用的子布局/渲染列表。有人可以为此发布必要的代码。
谢谢
我正在Sitecore 7.1
使用MVC
.
我需要获取用于特定 Sitecore 项目的子布局或渲染的项目 ID。有没有办法我使用.net 获取站点核心中的项目使用的子布局/渲染列表。有人可以为此发布必要的代码。
谢谢
在 Sitecore MVC 之前获取一组渲染的传统方法是:
Sitecore.Context.Item.Visualization.GetRenderings(Sitecore.Context.Device, false)
我相信这将返回 WebForms 和 MVC 上下文中的渲染列表。
具体到MVC,还可以使用currentRenderingContext
或者PageContext
via获取渲染列表:
RenderingContext.Current.PageContext.PageDefinition.Renderings
或者
PageContext.Current.PageDefinition.Renderings
请尝试以下代码
Sitecore.Context.Database.GetItem(((Sublayout)Parent).RenderingID);