Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a folder on media section called Slider. Under that folder there are many images.
I also added my document type a media picker called pictures. After pointing slider folder,
How can I loop through all the images by getting the url under Slider folder on media section using razor?
You can loop through all the images by using this piece of code.
var dynamicMediaFolder = Umbraco.Media(CurrentPage.pictures);
@foreach (var picture in dynamicMediaFolder.Children)
<img src="@picture.umbracoFile" alt="@picture.Name" />
Then you will print the image in a unordered list and get the url to the images. In my example I am using partial view macro files, but you can also use partial views
You are saying that you are using the content picker, then I take the seleted id of the folder and loop through the children (the images). You can find the documentation for the content picker here: https://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors/Media-Picker
I have used the dycnamic Razor, but you can also use the strongly typed Razor.
Hope this helps,
It works like a charm. Thank you very much for the help. I only changed first line
Sounds nice that it works like intended.
Yes then you are using Partial Views instead of Partial Views Macros.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted