Copied to clipboard

Flag this post as spam?

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


  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Sep 26, 2011 @ 09:48
    Kalle Ekstrand
    0

    Latest comments sort order?

    Hello!

    How do I get the latest comments to sort with the newest first by CreateDate on the comment node?

    //Kalle

  • Anthony Dang 1404 posts 2558 karma points MVP c-trib
    Sep 26, 2011 @ 18:35
    Anthony Dang
    0

    nodes = nodes.OrderbyDescending(x => x.CreateDate)

     

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Sep 27, 2011 @ 22:06
    Kalle Ekstrand
    0

    Hello,

    I get an Razor error when I do this. Its only on the right panel I want to do this.

            // get all comments
            nodes = ((IEnumerable<DynamicNode>)NodeHelper.GetComments(Model.Id)).Take(count);

    //Kalle

  • Anthony Dang 1404 posts 2558 karma points MVP c-trib
    Sep 28, 2011 @ 00:46
    Anthony Dang
    0

    What tyoe of error?

    Try breaking it up into 3 lines

     

    nodes =NodeHelper.GetComments(Model.Id);
    nodes = nodes.OrderbyDescending(x => x.CreateDate);
    nodes = 
    nodes.Take(count); 

     

  • Streety 350 posts 558 karma points
    Jan 26, 2012 @ 10:54
    Streety
    0

    Sorry this didn't work for me. I get

    Error loading Razor Script uBlogsyListComments.cshtml
    d:\ShareRoot\Websites\Mosaic v2\macroScripts\uBlogsyListComments.cshtml(27): error CS1061: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'OrderbyDescending' and no extension method 'OrderbyDescending' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)

     I need to mod both the latest posts and latest comments fields in the right hand collumn with the SMALL Param (1)

     

    Many thanks.,

     

    PS. Great package and easy to skin. Thank you for creating.

     

  • Anthony Dang 1404 posts 2558 karma points MVP c-trib
    Jan 26, 2012 @ 12:01
    Anthony Dang
    0

    I cant seem to replicate this issue.

    Can you paste your code here?

     

  • Streety 350 posts 558 karma points
    Jan 26, 2012 @ 12:25
    Streety
    0

    That's odd.

    Actually its your code from the starter kit. I haven't modded it...from uBlogsyListComments.cshtml.

     

    The mod you suggested:

     

    nodes =NodeHelper.GetComments(Model.Id);
    nodes = nodes.OrderbyDescending(x => x.CreateDate);
    nodes =
    nodes.Take(count);

     

    to replace

    nodes = ((IEnumerable<DynamicNode>)NodeHelper.GetComments(Model.Id)).Take(count);

    ...in your script gives me

    Error loading Razor Script uBlogsyListComments.cshtml
    d:\ShareRoot\Websites\Mosaic v2\macroScripts\uBlogsyListComments.cshtml(26): error CS1061: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'OrderbyDescending' and no extension method 'OrderbyDescending' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)

     

    Also as a side issue I would like to access the list posts macro in my home page.The blog site is not a subordinate of the main site though. What mods (or new script) would I need to make to get it working?

    I appreciate your time Anthony.

     

     

  • Anthony Dang 1404 posts 2558 karma points MVP c-trib
    Jan 26, 2012 @ 12:51
    Anthony Dang
    0

    I think this is your issue...

    OrderbyDescending should be OrderByDescending

    note the capital B

     

    Regarding your home page... 

    Change this line

    // get all posts
    IEnumerable<DynamicNode> postList = uBlogsy.Web.Helpers.NodeHelper.GetPosts(Model.Id)

    Replace the Model.Id with the id of the ublogsy landing node.

     

  • Streety 350 posts 558 karma points
    Jan 26, 2012 @ 13:24
    Streety
    0

    Thank you that did it.

     

    I cut 'n pasted and didn't check.

Please Sign in or register to post replies

Write your reply to:

Draft