Media gallery = new Media(999);
foreach (Media pic in gallery.GetDescendants()) { @pic.getProperty("umbracoFile").Value.ToString()
}
Which works fine. However, I want to exclude the top image as that's not going to be in the thumbnail controls. So, I need to do something along these lines
foreach (Media pic in gallery.GetDescendants().All().Where(x => x.Position() != 1))
Yes, but that's going to give me considerabley more lines of code (once we start bringing in showing the main one larger, handling only one image etc). I can do what I'm asking easily in xslt, it SHOULD be possible with razor
The Skip(1) part just skips the first item in the collection. You can then just access the media item properties directly since it is being used as a dynamic type.
Loop through some of gallery
So, I'm looping through items in a media folder
Which works fine. However, I want to exclude the top image as that's not going to be in the thumbnail controls. So, I need to do something along these lines
Obviously this syntax is wrong. Anyone help?
You could use an if statement to skip the first item.
Yes, but that's going to give me considerabley more lines of code (once we start bringing in showing the main one larger, handling only one image etc). I can do what I'm asking easily in xslt, it SHOULD be possible with razor
You should be able to do something like this using DynamicMedia item:
The Skip(1) part just skips the first item in the collection. You can then just access the media item properties directly since it is being used as a dynamic type.
Cool! Thank you very much.
Now, will
Just give me the first/main one?
I think you could just use
Thank you, again
is working on a reply...