We upgrade to web 8 and upgraded an existing .NET DD4T 1.31 website to .NET DD4T 2.0. We have made necessary changes to compile the Website with latest DD4T 2.0 DLL and web 8 DLLs and JAR files successfully. While Most of the websites works few of the Page templates which uses RenderComponentPresentationsByView is giving empty result.

When verified using Tridion Delivery API we are getting correct output.

When checked in the below post, it is mentioned to use @Html.Render(cp) while using DD4T View Models.

DD4T good practice: how to render component presentations based on ViewModels

We are using DD4T View Models, but Since it will take long time to change the code, can you please suggest how can we make RenderComponentPresentationsByView works in DD4T 2.0

Other issue we are facing to call render(cp) function is when we use below syntax we are getting null exception while trying to check component template metadata.

@foreach (var cp in Model.ComponentPresentations)
    if (CP.ComponentTemplate.MetadataFields["view"].Value  =="GenericBannerImage")

Any help would be appreciated.

Syntax used :

  • Can you verify that the ComponentTemplate Metadata is filled? I might be experiencing the same problem.
    – Thijs
    Feb 21, 2017 at 23:44

2 Answers 2


I've found the issues with the DD4T 2.x Core. It happens when using Dynamic Component Presentations. The 1.x Templates don't render Component Template data for the Dynamic Component Presentations, only the Component data.

However, the Component Template data is still in the Page. I've made a small fix for this and tested it on my local system. I will submit a bugfix later today, so it can be part of release 2.2.

Update: The fix is merged and now available in a pre-release: DD4T.Core


Have you checked your logs - ultimately RenderComponentPresentationsByView() calls into the DefaultComponentPresentationRenderer (unless you've provided you own IComponentPresentationRenderer implementation)?

Where DefaultComponentPresentationRenderer checks if the template of the presentation uses a view you might see a "view for GenericBannerImage not set" - which would suggest you haven't added the view name "GenericBannerImage" into the metadata view field of the component template.

You can also call RenderComponentPresentationsByView with a TCM ID too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.