How to render multiple media picker items within a blocklist?
Hi
New to Umbraco and I want to be able to list a sort of document library using a block list so the user can add a title and then select a number of documents.
I can display the title, but I'm a bit stuck on how to render the media picker items. I've used this code when having a single document library within a content page setting and was hoping I could just replace the model with the value, but it isn't working as I'm getting:
whether that bit in the < > brackets will tell the code that it is a list of media items coming back, and therefore .Count() is a valid thing to call...
Thanks for the reply. However if I try that I get this error:
The type or namespace name 'MediaWithCrops' could not be found (are you missing a using directive or an assembly reference?) Argument
1: cannot convert from 'method group' to 'object?'
Edit: I've got it working :-) What I had to do was change it to this:
var multiMediaPicker = content.Value<IEnumerable<IPublishedContent>>("documents").ToArray();
How to render multiple media picker items within a blocklist?
Hi
New to Umbraco and I want to be able to list a sort of document library using a block list so the user can add a title and then select a number of documents.
I can display the title, but I'm a bit stuck on how to render the media picker items. I've used this code when having a single document library within a content page setting and was hoping I could just replace the model with the value, but it isn't working as I'm getting:
cannot convert from 'method group' to 'object?'
Many thanks
Hi Adamski
I'm thinking when you use .Value that's fine for a string, but it's not telling the razor that your property is a more complex thing
So I wonder if you have
whether that bit in the
< >
brackets will tell the code that it is a list of media items coming back, and therefore .Count() is a valid thing to call...regards
Marc
Thanks for the reply. However if I try that I get this error:
The type or namespace name 'MediaWithCrops' could not be found (are you missing a using directive or an assembly reference?) Argument 1: cannot convert from 'method group' to 'object?'
Edit: I've got it working :-) What I had to do was change it to this:
and add to the top
is working on a reply...