Sitecore Controller Rendering DataSource

社会主义新天地 提交于 2019-12-10 11:20:01

问题


I have a component in Sitecore that can be used in the middle section of the page. It shows a video and is setup as a controller rendering in Sitecore. I have been able to get this to work by setting the DataSource on the rendering on the page item.

I have another component for the middle section of the page. This is a list of videos. Each video output has the exact same HTML as the rendering mentioned in the previous paragraph. I'm trying to call the controller rendering (mentioned above) in the rendering for this list rendering something like this -

@Html.Sitecore().Controller("VideoController", "Display")

I'm trying to set the DataSource in/before calling the .Controller function but I haven't found a way to do it. I'm looking for some answers on how to set the DataSource or call a controller rendering from another rendering.

Thanks


回答1:


This should be possible by statically binding the renering and add the datasource as a parameter:

@Html.Sitecore().Rendering("<your rendering definition item id>", new { DataSource = "<your datasource item id>" })


来源:https://stackoverflow.com/questions/25597940/sitecore-controller-rendering-datasource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!