Syntax controller Rendering DataSource

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

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

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

I am trying to set the DataSource to / before calling the .Controller function, but I have not found a way to do this. I am looking for some answers on how to install a DataSource or invoke controller rendering from another rendering.

thanks

+1
source share
1 answer

This should be possible by statically binding the regeneration and adding a data source as a parameter:

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

Source: https://habr.com/ru/post/1209166/


All Articles