Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Apr 02, 2013 @ 11:21
    Anthony Candaele
    0

    DynamicNodeList OrderBy

    Hi,

    I'm trying to do a simple OrderBy on a DynamicNodeList item, but I can't seem to pull this off.

    Any knows how to do an OrderBy on a DynamicNodeList in Razor, say on createDate?

    Thanks for your help,

    Anthony

  • Fuji Kusaka 2203 posts 4220 karma points
    Apr 02, 2013 @ 11:47
    Fuji Kusaka
    100

    How about

      var sortedItems = Items.Children.Where("Visible").OrderBy("createDate descending");
  • Anthony Candaele 1197 posts 2049 karma points
    Apr 02, 2013 @ 14:49
    Anthony Candaele
    0

    Hi Fuji,

    Thanks, I refactored my code a bit. I got rid off the DynamicNodeList object and dit the ordering and filtering directly in my foreach loop like this:

    foreach (var publication in publications.Where("publicationType == \"" + publicationtype + "\" && visible").OrderBy("createDate desc"))
    {
    ...
    }

    thanks,

    Anthony 

  • Brian 3 posts 23 karma points
    Aug 07, 2013 @ 15:55
    Brian
    0

    Does anybody know how to use .OrderBy for multiple properties, because .OrderBy("name, createDate") does not work and .OrderBy("name", "createDate") either. I use Umbraco 4.11.8

Please Sign in or register to post replies

Write your reply to:

Draft