How to display content part when overriding display template for custom content type?

Topics: Writing modules, Writing themes
Aug 17, 2011 at 1:36 AM


I have a custom content type and have attached a custom built content part to it.  The content part expects a specific view model to render from.

In the display template for my content type how do I render the custom content part and pass the view model it expects?

I have tried a very basic example where I create a new instance of the view model class, and the call @Display(New.MyPart(newViewModelInstance)), but when orchard attempts to render the display template for the part I get an exception indicating that the template expected a view model of the type I am sending it but that it instead got IShapeProxy (plus a bunch of stuff on the end).


Aug 17, 2011 at 6:18 PM

In the template you personally define which mode it will accept, or it's dynamic by default. And in the content part's driver, you also send the view model you want, So in theory it's up to you to have both of them to match.

Have you checked some content part samples ?