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:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
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.
Rendering partial view in macro
Hi kids.
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.
Hi Gísli.
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.
Take care!
Thank you Dennis. I removed the @inherits Umbraco.Web.Mvc.UmbracoTemplatePage and that did the trick.
mvh
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 @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
is working on a reply...