1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Image sort order in albums

Image sort order in albums

6 posts, 1 answered
  1. Solomon Shaffer
    Solomon Shaffer avatar
    22 posts
    Registered:
    18 Jan 2011
    19 May 2011
    Link to this post
    I noticed in the backend that you are able reorder the images in a album. This is excellent that this feature is included and just what I am looking for. 

    I cannot find the property in the Model.Image or Model.Album objects to get this value. Anyone know if this property is available in the API?

    I am looking for something like:

    var album = GetAlbumByName("Homepage Random Current Trip Images");
     
    var images = album.Images.ToList().Where(image => image.Status == ContentLifecycleStatus.Live).OrderBy(image => image.XXX);

    Thanks,

    Solomon Shaffer

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    20 May 2011
    Link to this post
    Hi Solomon,

    We sort the image through service ImageService. Here is an example for sorting by Title.

    Sitefinity/Services/Content/ImageService.svc/?managerType=&providerName=&itemType=Telerik.Sitefinity.Libraries.Model.Image&provider=&sortExpression=Title%20ASC&skip=0&take=50

    You can use the following methods to make sorting

    items = DataProviderBase.SetExpressions(items, filter, sortExpression, culture, skip, take, ref totalCount);

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Solomon Shaffer
    Solomon Shaffer avatar
    22 posts
    Registered:
    18 Jan 2011
    20 May 2011
    Link to this post
    Thanks for the quick reply. I can sort the list I get back using LINQ (by title or any other public property). I am looking for the order property that is assigned to a image when you reorder the images in an album (click on an album > Album Actions > Reorder Images). How do I sort my list in the order I specify in the backend?

    Thanks!

    Solomon Shaffer
    Intrinsic Industries
  4. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    20 May 2011
    Link to this post
    @Solomon, you want to sort by the property "Ordinal" when you drag and drop images to set the sort order the value is stored in the Ordinal field.

    Pretty sure that's what you are looking for.

    Regards,
    Phill
    Answered
  5. Solomon Shaffer
    Solomon Shaffer avatar
    22 posts
    Registered:
    18 Jan 2011
    20 May 2011
    Link to this post
    OK. Now I feel silly. That was it. Thanks, Phil!

    Solomon Shaffer
    Intrinsic Industries
  6. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    20 May 2011
    Link to this post
    Not a problem and not so silly, I spent some time looking for something called "SortOrder" as that seemed logical to me. Glad I could put you on the right track.

    Cheers,
    Phill
6 posts, 1 answered