You're using the ViewTemplateModelRegistrator to hook up the page partials, correct?
I understand what you are trying to do, and it logically makes sense, but I can't think of a way to do this using a page partial, unless you put the logic to get the children directly in the Razor view.
I think the alternate approach is to make a block with a PageReference property, but I'm sure you already are aware of this approach.
I've love to see if anyone can provide a solution to this...
See Johan's answer in this thread:
For the site I am currently working, we ant to give the user the ability to drag and drop pages from the menu structure into a dropzone and render a link to that page, and all of the children for that page underneath it. As I need to do a bit of logic to get the children, I want to be able to create a ViewModel for that partial view to get the data, rather than messing up my view with it. In order to do this Im preetty confident I will need its own controller.
I am having some problems getting it working though, I have used a similar approach to this for adding custom renderer's for blocks before so I was hopeful this would work but so far no luck. I have a controller as the folliowing:
My ViewModel (still needs some logic):
Then at the moment my very simple view:
The error I am being thrown is:
System.InvalidOperationException: The model item passed into the dictionary is of type 'Castle.Proxies.StartPageProxy', but this dictionary requires a model item of type 'EPiServer.Templates.Logicalis.Models.ViewModels.FooterMenuViewModel'.
Can anyone suggest where I may be going wrong or if there is an alternate approach?
Many thanks in advance!!!!