I have a page with several component presentations using the component template 'Promotion'. In my page view '_Page.cshtml' I wish to write out all component presentations using this template and for every second occurance write some HTML just after i've written the component presentation.
I would use the following code to write out all presentations of a certain template:
@Html.RenderComponentPresentationsByView("Promotion")
I figured I could replace this code with the following (where my Model = IPage):
@foreach (ComponentPresentation cp in Model.ComponentPresentations)
{
if (cp.ComponentTemplate.Title == "Promotion")
{
//Logic here to render my specific CP through HTML.RenderComponentPresentations() or something else?
}
}
I need to replace my comment with code to achieve the same result as RenderComponentPresentationsByView but for a single component presentation.
any Ideas on how to achieve this?
Thanks in advance