I want to list all my featured news at the top but i can't get them in the right order. This is what i got:
var featuredNewsCollection = allNewsCollection.Where(x => featuredNewsIds.Contains(x.Id));
This lists the featured news in the order they appear in allNewsCollection. I want them in the order from my featuredNewsIds int list. Is there a smart way to rearrange this?
Compiler Error Message: CS1928: 'System.Linq.IQueryable<Umbraco.Core.Models.IPublishedContent>' does not contain a definition for 'OrderBy' and the best extension method overload 'Umbraco.Web.PublishedContentExtensions.OrderBy(System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IPublishedContent>, string)' has some invalid arguments
Order nodes
I want to list all my featured news at the top but i can't get them in the right order. This is what i got:
This lists the featured news in the order they appear in
allNewsCollection
. I want them in the order from myfeaturedNewsIds
int list. Is there a smart way to rearrange this?Hi Johan,
Maybe you could do something like this:
Hope this helps,
/Dennis
@Dennis That generates this error message:
Edit:
featuredNewsIds
is a list of IDs. I asked the question at Stackoverflow too. http://stackoverflow.com/questions/26339794/reorder-umbraco-razor-nodesGot this answer on Stack Overflow
Worked!
is working on a reply...