I have document type that I use for Nested Content. It has an MNTP property, and I have problems rendering the picked nodes.
See screenshot of document type
I am getting the error: "'Umbraco.Web.PublishedContentModels.Site_nested_contactGroup' does not contain a definition for 'GetPropertyValue'"
This code is in my view:
var items = CurrentPage.GetPropertyValue<IEnumerable<IPublishedContent>>("contactpersons");
foreach(var item in items)
{
var persons = item.GetPropertyValue<IEnumerable<IPublishedContent>>("persons");
<h2>@Umbraco.Field(item, "headline")</h2>
foreach (string contactperson in persons)
{
.... render contactperson....
}
}
Instead of this:
var items = CurrentPage.GetPropertyValue<IEnumerable<IPublishedContent>>("contactpersons");
foreach(var item in items)
{
var persons = item.GetPropertyValue<IEnumerable<IPublishedContent>>("persons");
<h2>@Umbraco.Field(item, "headline")</h2>
foreach (string contactperson in persons)
{
.... render contactperson....
}
}
Try with:
var items = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("contactpersons");
foreach(var item in items)
{
var persons = item.GetPropertyValue<IEnumerable<IPublishedContent>>("persons");
<h2>@Umbraco.Field(item, "headline")</h2>
foreach (string contactperson in persons)
{
.... render contactperson....
}
}