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 am using the Nested Content package
And within in that I have a media picker that is an image which uses a media type that has a set of crops against it.
I can display the image fine and the image for each crop but I need to order the images by the width of the crop.
I've tried .OrderBy("width"), .OrderBy(x => x.Width) but get the error:
.OrderBy("width")
.OrderBy(x => x.Width)
''System.Collections.Generic.List<Umbraco.Web.Models.ImageCropData>' does not contain a definition for 'OrderBy''
Code
@foreach (var item in Model.Content.SubService) { string sectionImage = item.GetPropertyValue<string>("image"); string sectionTitle = item.GetPropertyValue<string>("title"); string sectionCopy = item.GetPropertyValue<string>("copy"); // image & crop details string ImagePath = ""; string ImageWidth = ""; var Image = @Umbraco.Media(sectionImage); var FileData = @Image.GetPropertyValue("umbracoFile"); var ImageCrop = @FileData.Crops; @foreach (var crop in ImageCrop.OrderBy("width")) { } }
Thanks for any help.
Have you added a using for Linq?
@using System.Linq
Just tried it but no joy.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Image cropper ordering by width of crop size
I am using the Nested Content package
And within in that I have a media picker that is an image which uses a media type that has a set of crops against it.
I can display the image fine and the image for each crop but I need to order the images by the width of the crop.
I've tried
.OrderBy("width")
,.OrderBy(x => x.Width)
but get the error:Code
Thanks for any help.
Have you added a using for Linq?
@using System.Linq
Just tried it but no joy.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.