Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi Folks,
Is there a minimum quantity allowed for .Take(X)? I'm looking to display just one node which has the most recent 'date' field - it works with .Take(8) and above, but below it displays the SortOrder - here's my partial:
@{ var selection = CurrentPage.Site().FirstChild("NewsRepository").Children("NewsItem").Where("Visible").Take(1).OrderBy("date desc");}<ul class="news-feed"> @foreach(var item in selection){ <li> <h4><a href="@item.Url">@item.Name</a></h4> <span style="color:#888; font-size:14px"> @item.Date.ToLongDateString() </span> </li> }</ul>@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
Thanks Darren
Darren,
you'd need to .OrderBy() first before performing a .Take()
--Dirk
Hi Dirk,
This solved it! I would have never guessed that!
Darren
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
.Take(1).OrderBy("date") displays SortOrder
Hi Folks,
Is there a minimum quantity allowed for .Take(X)? I'm looking to display just one node which has the most recent 'date' field - it works with .Take(8) and above, but below it displays the SortOrder - here's my partial:
Thanks Darren
Darren,
you'd need to .OrderBy() first before performing a .Take()
--Dirk
Hi Dirk,
This solved it! I would have never guessed that!
Darren
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.