Copied to clipboard

Flag this post as spam?

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


  • Streety 358 posts 568 karma points
    Mar 16, 2012 @ 10:58
    Streety
    0

    Comments not in latest date order

    Hi Antony,

    I have noticed that the Latest Comments are not being displayed in the correct order, ie last comment first. Analysing your other razor scripts for a clue I am none the wiser. Is this a feature?

     

    Thanks.

     

    blog.promulgate.co.uk

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 16, 2012 @ 19:11
    Anthony Dang
    0

    Let's call it a feature :/

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 26, 2012 @ 00:40
    Anthony Dang
    0

    ps. You can easily add a sort.

    it will be something like:

     .OrderByDescending(x => x.CreateDate);

     

  • Streety 358 posts 568 karma points
    May 02, 2012 @ 14:16
    Streety
    0

    Sorry Anthony.

    Where in the listcomments script is this applied? Is it here?

     

    nodes = ((

     

    IEnumerable<DynamicNode>)CommentService.Instance.GetComments(Model.Id, true)).Take(count).OrderByDescending(x=> x.CreateDate);

     

     

    Still learning Razor

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    May 04, 2012 @ 11:09
    Anthony Dang
    0

    OrderByDescending() should go before the Take()

    IEnumerable<DynamicNode>)CommentService.Instance.GetComments(Model.Id, true)).OrderByDescending(x=> x.CreateDate).Take(count);

    Order the comments, then Take a few from the ordered list.

     

Please Sign in or register to post replies

Write your reply to:

Draft