ModelBindingException: Cannot bind source type System.Collections.Generic.List`1[[ccc.Core.Models.Advantage, ccc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to model type ccc.Core.Models.Advantage.
i saw your videos on youtube and i learned allot from the thank you for them :-)
i didnt saw video about nested content with umbraco 9 and rendering it
Nested Content
hii :-)
i am new in umbraco cms i am using Umbraco 9.5 with .Net Core and i trying to set document type as nested content by the nested content guide https://our.umbraco.com/Documentation/Fundamentals/Backoffice/property-editors/built-in-property-editors/Nested-Content/
and i am getting error "ModelBindingException: Cannot bind source type ccc.Core.Models.HomePage to model type ccc.Core.Models.Advantage."
i triyed everything and i dont know what is the problem please help me
Advantage Document Type as element type:
Home Page:
The easy way to solve this would be to hang the Model in the partial to be HomePage instead of Advantage.
hii :-)
thank you for the answer but if i want use Advantage in other pages it will work?
No. In that case. Pass in the property to the partial and use that as the model. You can do that like this:
@await Html.PartialAsync("NestedContent/Advantage", Model.AdvantageProperty)
i tried now i getting another error... :-(
ModelBindingException: Cannot bind source type System.Collections.Generic.List`1[[ccc.Core.Models.Advantage, ccc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] to model type ccc.Core.Models.Advantage.
i saw your videos on youtube and i learned allot from the thank you for them :-) i didnt saw video about nested content with umbraco 9 and rendering it
Ok now change your model to this
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<>
I’m glad you found my videos useful.
Paul
lets leave the Advantage Element eside
What is the right way to implement nested content and rendering it with umbraco 9 with .NET core? the simpliest and basic way
did you have code example for it?
Here’s an example partial in my starter kit https://github.com/prjseal/Portfolio-Starter-Kit-fo-Umbraco/blob/master/Portfolio.Site/Views/Partials/latestProjects.cshtml
thanks a lot it works with ToArray()
Home Page:
Advantage:
is working on a reply...