Hello, i am trying to get the children of my multiple media picker. In backend i have picked a folder with 2 images.
I can write "@Model.KarusselMappe" ("KarusselMappe" is my property name of the media picker) and it gives me an id: 1057 which is the id of the folder i have picked. But how can i get the children of this folder.
I have tried with:
var karusselMappeId = Model.KarusselMappe;
foreach (var image in karusselMappeId.children)
But i says: String does not contain a definition for children.
Get children by ID of multiple media picker
Hello, i am trying to get the children of my multiple media picker. In backend i have picked a folder with 2 images. I can write "@Model.KarusselMappe" ("KarusselMappe" is my property name of the media picker) and it gives me an id: 1057 which is the id of the folder i have picked. But how can i get the children of this folder.
I have tried with: var karusselMappeId = Model.KarusselMappe; foreach (var image in karusselMappeId.children)
But i says: String does not contain a definition for children.
Can someone help?
I think you will need to get the TypedMedia item for the ID of the folder
Umbraco.TypedMedia(karusselId)
This will return an iPublishedContent item, which should then provide the children.
The ID value is just an integer, so it wont know anything about Umbraco at that point.
Hope that helps a little.
Hey Richard,
THANKS, that works. I now have the ID of my images in my picked folder. Thanks a lot!
Glad that helped you out.
is working on a reply...