Copied to clipboard

Flag this post as spam?

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


  • PCharb 22 posts 42 karma points
    Jun 27, 2011 @ 16:01
    PCharb
    0

    order ChildNode

    Hi, 
       
       I only want to know how to order the childnode of a folder. I've got some "News & Events" ordered by years(FolderName) what I want to do is redirect the "News" folder to the most recent years with no umbraco.Redirect I want this to be automate, If someone add 2012, it will redirect to 2012, Ive already have the code to know the url and redirect to a page, I've only missing the Find Most Recent news part, i'm going to continu my search, but if someone could help me to accelerate my work, it will be great. 

    Thank you

  • PCharb 22 posts 42 karma points
    Jun 27, 2011 @ 19:19
    PCharb
    0

    I've find it, 

    you only have to return in the first loop of the foreach to get only the first one 

    For those who will have this problem, here's the code. In my situation, this code is generated only in one page and always in the same page so that's why I don't get the node by Id before.

      foreach (var ArticleList in @Model.DescendantsOrSelf("ArticleList").OrderBy("Name desc"))
      {
         return ArticleList.Url.ToString();
      }
     

Please Sign in or register to post replies

Write your reply to:

Draft