Umbraco 8 OrderBy a collection by a Custom Field Such as a Date
This is a snippet for Umbraco 8 to Order a collection by a Custom Field Such as a Date.
@{
var selection = Umbraco.Content(Model.Id)
.ChildrenOfType("publication")
.Where(x => x.IsVisible())
.OrderBy( x => x.Value("publicationDate"));
}
@foreach (var item in selection.Take(1))
{
<h2><a href="@item.Url" title="@item.Name">@item.Name</a></h2>
}
@{
var selection = Umbraco.Content(Model.Id)
.ChildrenOfType("publication")
.Where(x => x.IsVisible())
.OrderBy( x => x.Value("publicationDate"));
}
@foreach (var item in selection.Take(1))
{
<h2><a href="@item.Url" title="@item.Name">@item.Name</a></h2>
}
Umbraco 8 OrderBy a collection by a Custom Field Such as a Date
ReplyDeleteVery informative post..!!
Well, we are here to share Mobile App Development Company
Cross Platform Mobile App Development
Waiting for your future posts...