linq - OrderBy multiple properties in Razor and Umbraco 4.11.8 -
during update of our website umbraco, upgraded 4.7.2 4.11.8.
in cshtml-file had code:
foreach(var item in model.ancestororself("master") .items.first() .publicationfolder.first() .children.where("visible") .orderby("publicationtype, date desc"))
it worked fine , sorted collection first publicationtype , newest date.
in new version (4.11.8) doesn't work anymore. gives me exception: at least 1 object must implement icomparable.
and if write .orderby("publicationtype", "date desc")
, doesn't affect collection.
so bug or doing wrong? there workaround?
i found solution need cast collection list<dynamicnode>
works.
foreach (var item in ((list<dynamicnode>)@model.ancestororself("master") .items.first() .publicationfolder.first() .children.where("visible").items) .orderby(t => t.getpropertyvalue("publicationtype")) .thenbydescending(t => t.getpropertyvalue("date")))
Comments
Post a Comment