@foreach (var t in Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("myAlias"))
{
foreach (var publishedProperty in t.Properties)
{
@(publishedProperty.Value)<br/>
}
}
it only outputs the 'title' and 'price' values...
i really need the 'key' as i'm working on the basis this is the unique id for the item and we're using it as a selection in a form.
or am i chasing the wrong monkey up the wrong tree?!
is it possible to access the 'key' value from a nested content item?
hey out there,
something i wanted to check: is it possible to access the 'key' value from a nested content item?
i've been debugging my code and i can see this coming back for my nested content item:
using something like this:
it only outputs the 'title' and 'price' values...
i really need the 'key' as i'm working on the basis this is the unique id for the item and we're using it as a selection in a form.
or am i chasing the wrong monkey up the wrong tree?!
cheers,
jake
You should be able to use the
GetKey()
extension method inUmbraco.Web
namespace. So:This is assuming you are using a recent version of Umbraco.
boom! that's epic and works a treat ;)
now all i gotta do is get that working with ditto! i'm thinking i'm gonna have to build a custom processor as it's defo not doing it out of the box...
thanks dan, top work.
is working on a reply...