Argument type 'Umbraco.Web.Models.RenderModel' is not assignable to model type 'Umbraco.Web.Models.RenderModel<model>'
Umbraco 7.4.1
Hey
I am sitting with a strange problem.
And I'm new to this SurfaceController...
Argument type 'Umbraco.Web.Models.RenderModel' is not assignable to model type 'Umbraco.Web.Models.RenderModel<MovieRating.Models.FilmModel>'
public class RatingController : SurfaceController
{
[ChildActionOnly]
public ActionResult GetRatingForm(int filmId)
{
if (Members.IsLoggedIn())
{
var umbracoContext = UmbracoContext.ContentCache.GetById(filmId);
var model = new FilmModel(umbracoContext);
return PartialView("~/views/Partials/_RatingForm.cshtml", new RenderModel(model));
}
return null;
}
}
Argument type 'Umbraco.Web.Models.RenderModel' is not assignable to model type 'Umbraco.Web.Models.RenderModel<model>'
Umbraco 7.4.1
Hey I am sitting with a strange problem. And I'm new to this SurfaceController...
Suspect the problem is with your _RatingForm.cshtml View - I'm new to Umbraco and had the SAME problem yesterday...
_RatingForm.cshtml has this as inherits. Can you see what it could be?
How are you calling the GetRatingForm controller?
Like this
You've passed new RenderModel(model)) in your controller when it should be model...
It does not remove the error
is not assignable to model type
. And I 've also tried. The website works. So I do not know what is happening or why...Hello,
from your controller method return the model of type FilmModel directly:
Then in your partial view, inherits the "FilmModel" instead of "@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
To access any property value do:
Ronish Potiah Thank you very much :)
And thank you Toppers
FilmModel is of type IPublishedContent ( obvious? )
is working on a reply...