Calling a child action from block view (EPiServer 8)

Vote:
 

Not sure if this just an MVC restrcition or something EPiServer specific.

Basically I have an EPiServer Page (controller & view) - in this page I have a ContentArea which contains one block - this block has a controller & view.

At this point everything works as normal - page renders, block renders.

Now, I have a normal MVC MapController with a single child action ([ChildActionOnly]) and view that checks default and renders a Google Map.

If I call this from my page, I see the map:

@Html.Action("Index", "Map", new { Longitude = Model.Rally.Longitude.GetValueOrDefault(), Latitude = Model.Rally.Latitude.GetValueOrDefault(), LegendConfiguration = legend })

But, if I call this from by block view, in the same way, I always receive an error:

The model item passed into the dictionary is of type '...', but this dictionary requires a model item of type '...'.

I know what this errors means, but my Html.Action is passing the right model - it simply seems to be ignored when the contaxt is with the block view, which I believe is a child action itself?

Is this a known thing?

You cant pass a custom model to a child action from the context of a child action?

#146323
Mar 16, 2016 10:18
Vote:
 

Ok - thanks to EPiServer support, the answer was to include "controllerType":

@Html.Action("Index", "Map", new { Longitude = Model.Rally.Longitude.GetValueOrDefault(), Latitude = Model.Rally.Latitude.GetValueOrDefault(), LegendConfiguration = legend, controllerType="" })

Here be dragons!

#146894
Mar 30, 2016 10:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.