Sitecore控制器渲染数据源 [英] Sitecore Controller Rendering DataSource

查看:96
本文介绍了Sitecore控制器渲染数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Sitecore中有一个可在页面中间部分使用的组件.它显示了一个视频,并在Sitecore中设置为控制器渲染.通过在页面项目的呈现上设置数据源,我已经能够使它工作.

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.

页面中间部分还有另一个组件.这是视频列表.每个视频输出具有与上一段中提到的渲染完全相同的HTML.我试图在该列表的渲染中调用控制器渲染(如上所述)-

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")

我正在尝试在调用.Controller函数之前/之内设置数据源,但是我还没有找到一种方法来做到这一点.我正在寻找有关如何设置数据源或从另一个渲染调用控制器渲染的一些答案.

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.

谢谢

推荐答案

这应该可以通过以下方式实现:静态绑定调价并添加数据源作为参数:

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>" })

这篇关于Sitecore控制器渲染数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆