Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to render a partial view in a macro?
When I try
I get this error
"Cannot bind source type Umbraco.Web.Models.PartialViewMacroModel to model type Umbraco.Web.Models.RenderModel."
This doesn't render the content.
The way you've written in you first code is correct, by writing Html.Partial("..").
The problem however is that if you are inside a macro partial view (which im suspecting), then that view is inheriting from PartialViewMacroModel and the partial view that you trying to include with a partial has a model of type RenderModel, usually because partial views created from the backoffice have this as the first line of code:
How does your partial look? Can you paste in your code from the search-form partial? Do you need that partial to inherit from UmbracoTemplatePage? If not then remove that line. If yes, we can have a look at your code and see how to fix this.
Thank you Dennis.
I removed the @inherits Umbraco.Web.Mvc.UmbracoTemplatePage and that did the trick.
Awesome! Happy to be able to help! :)
Take care and have a great day!
Also you can use Html.RenderPartial, and with this you don't need to remove
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted