Didn't you have any luck with `OrderByDescending`, omitting the text directive of direction? You may also need to tweak the property name a little (CreateDate is just an alias of sorts, UtcCreated (or something like that, take a look at the Content type (maybe need to drill down into ITypedEntity)) is the 'real' name. But, worth noting, Linq stuff doesn't really work inherently with 'attached', proper properties... mostly just document type properties and those supported by specific coding in the core).
@foreach(var eventsItem in eventsNode.Children.Take(6).OrderBy("CreateDate desc"))
I tried without luck but I get the following error
Error Loading Razor Script (file: List News Of6 Item) Cannot implicitly convert type 'umbraco.MacroEngines.DynamicNode' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?) at CallSite.Target(Closure , CallSite , Object )
Filter by date?
I try to display last added 6 event item by creation date under event node. Any help much appreciated.
Didn't you have any luck with `OrderByDescending`, omitting the text directive of direction? You may also need to tweak the property name a little (CreateDate is just an alias of sorts, UtcCreated (or something like that, take a look at the Content type (maybe need to drill down into ITypedEntity)) is the 'real' name. But, worth noting, Linq stuff doesn't really work inherently with 'attached', proper properties... mostly just document type properties and those supported by specific coding in the core).
What I tried in foreach loop actually
@foreach(var eventsItem in eventsNode.Children.Take(6).OrderBy("CreateDate desc"))
I tried without luck but I get the following error
Error Loading Razor Script (file: List News Of6 Item) Cannot implicitly convert type 'umbraco.MacroEngines.DynamicNode' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?) at CallSite.Target(Closure , CallSite , Object )
Can you try something like
If any not mistaken you should be ordering the first part that is the EventNode and remember to inherit the @inherits umbraco.MacroEngine.
//fuji
is working on a reply...