DD4T 1.3 comes with a few Html extension methods that allow us to render Component Presentation inside a Page Razor view using different ways of filtering through the list of ComponentPresentations on the IPage object: RenderComponentPresentations() -- renders all ComponentPresentations on the page; RenderComponentPresentationsBySchema() -- renders only ComponentPresentations whose Component is based on a given Schema title or TcmUri; RenderComponentPresetnationsByView() -- renders only ComponentPresentations whose ComponentTemplate uses a given view name or has a given TcmUri; There is however, no helper method that allows the rendering of just a simple plain ComponentPresentation, yet sometimes that is exactly what I would need. Below is one such Html extension method that calls the rendering of only the given ComponentPresentation object: public static MvcHtmlString RenderComponentPresentation ( this HtmlHelper htmlHelper, IComponentPresentation cp) { if ...
talk is cheap. show me the code.