You were pretty close! Cutting a to the chase, this is what you want...
var items = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("title");
That will give you the strongly-typed IPublishedContent nodes.
The issue with using Model.GetPropertyValue<string>("title") is that you are asking for a string object type, so that's what you get... but because of how NestedContent's property-value converter works, it would be a string of an IPublishedContent, which I would expect to literally be "Umbraco.Core.Models.IPublishedContent".
As for using Umbraco.Field ... eek, I'm not sure how exactly Umbraco internals work on that. To be honest, I wouldn't expect it to work, as I think it queries the content-cache, but that's outside of NestedContent's scope ... as frustrating as that may be :-(
A bit offtopic but for Nested Content and the Doc Type Grid Editor you both need doctypes. With the Models Builder you can generate models for those doctypes and map to those models.
I think there is a bit of info missing. What is you NC property called on your DTGE doc type? As I think you'll need to do something like
var ncItems = Model.GetPropertyValue<IEnumberable<IPublishedContent>>("ncPropAlias");
foreach(var item in ncItems){
var title = item.GetPropertyValue("title");
}
or, if you only have one item in your NC list, something like:
var title = Model.GetPropertyValue<IEnumberable<IPublishedContent>>("ncPropAlias").First().GetPropertyValue("title");
@jeroen appreciate your help but I kinda feel introducing models builder would just complicate the matter so lets try to stick to the question at hand (it does come across a little spammy as well so do be careful)
DocType Grid Editor is not rendering the property values on 7.4.3
Hi,
I'm using nested content & doctype grid editor and when I try to render the property values, the values are not being mapped using:
But the output is:
y | {} | System.Web.IHtmlString {System.Web.HtmlString}
The DataValue of the Model is:
Any ideas?
For the time being I've created this:
Thanks, Ale
Hi Ale,
You were pretty close! Cutting a to the chase, this is what you want...
That will give you the strongly-typed
IPublishedContent
nodes.The issue with using
Model.GetPropertyValue<string>("title")
is that you are asking for astring
object type, so that's what you get... but because of how NestedContent's property-value converter works, it would be astring
of anIPublishedContent
, which I would expect to literally be"Umbraco.Core.Models.IPublishedContent"
.As for using
Umbraco.Field
... eek, I'm not sure how exactly Umbraco internals work on that. To be honest, I wouldn't expect it to work, as I think it queries the content-cache, but that's outside of NestedContent's scope ... as frustrating as that may be :-(I hope this helps?
Cheers,
- Lee
Hi Lee,
Thanks for your answer, that line doesn't return the values either, nulls every where.
Would be good to have some sort of extension to map the values as needed, more umbraco-ish way.
Thanks, Ale
A bit offtopic but for Nested Content and the Doc Type Grid Editor you both need doctypes. With the Models Builder you can generate models for those doctypes and map to those models.
Check the "Using with the Models Builder" part of this blog: http://24days.in/umbraco/2015/multilingual-vorto-nested-content/
Jeroen
Hi Ale,
I think there is a bit of info missing. What is you NC property called on your DTGE doc type? As I think you'll need to do something like
or, if you only have one item in your NC list, something like:
@jeroen appreciate your help but I kinda feel introducing models builder would just complicate the matter so lets try to stick to the question at hand (it does come across a little spammy as well so do be careful)
Hi @Matt,
You were right I was trying to get the properties using the of the actual property alias (title) instead of using the NC property alias.
I'm clear now and it working.
@Jeroen I'll have a look to your suggestion :)
Thank you so much!
Ale
is working on a reply...