This works fine, but it goes wrong if multiple pages are made on a single date
I want to add a second field to order on.
but things like
.OrderBy("newsdate desc").OrderBy("id desc")
.OrderBy("newsdate, id desc")
.OrderBy("newsdate ").ThenByDescending("id")
all don't work. Or the sorting on ID is ignored, or errors like
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'ThenBy' at CallSite.Target(Closure , CallSite , Object , String )
are returned.
Also something like Listpages = new DynamicNode(1962).DescendantsOrSelf("Aantekening").Items.OrderByDescending(a => a.CreateDate).ToList().Take(5).ToList(); which I found isn't working, using => in here returns an error I cannot use a lambda expression.
So is there a way to just simply chain 2 orderBy's so the items can be sorted correctly?
multiple orderby in cshtml
I try to do a multiple orderby for sorting pages that can be used as newsitems.
allPages = Model.AncestorOrSelf(1).Descendants().Where("showAsNews").OrderBy("newsdate desc")
This works fine, but it goes wrong if multiple pages are made on a single date I want to add a second field to order on.
but things like .OrderBy("newsdate desc").OrderBy("id desc") .OrderBy("newsdate, id desc") .OrderBy("newsdate ").ThenByDescending("id") all don't work. Or the sorting on ID is ignored, or errors like
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'ThenBy' at CallSite.Target(Closure , CallSite , Object , String )
are returned.
Also something like Listpages = new DynamicNode(1962).DescendantsOrSelf("Aantekening").Items.OrderByDescending(a => a.CreateDate).ToList().Take(5).ToList(); which I found isn't working, using => in here returns an error I cannot use a lambda expression.
So is there a way to just simply chain 2 orderBy's so the items can be sorted correctly?
running on Umbraco 6.1.6
Does this help?
Andy
is working on a reply...