With DynamicObject (DynamicNode too, because it inherits from), the c# compiler / razor parser doesn't allow you to use the familiar lambda syntax to filter your sets. This is because we now return a DynamicObject [DynamicNodeList] to allow method chaining.
Orderby on nodeproperty that's a Xpath Dropdownlist
Hi,
How can i do an OrderBy on a property (in this case 'Type') of a node which is of type "Xpath Dropdownlist".
I tried Model.Artikels.OrderBy("type") but it gave an "At least one object must implement IComparable".
Tnx in advance!
Garret
Hi Garret,
I'm not exprt in the "DynamicNode" (old) Razor, but you may need to use a lambda expression?
Cheers, Lee.
Hi Lee,
According to http://umbraco.com/follow-us/blog-archive/2011/3/1/umbraco-razor-feature-walkthrough-%E2%80%93-part-4.aspx that's not possible.
///
With DynamicObject (DynamicNode too, because it inherits from), the c# compiler / razor parser doesn't allow you to use the familiar lambda syntax to filter your sets.
This is because we now return a DynamicObject [DynamicNodeList] to allow method chaining.
This will not work in 4.6.1 or 4.7.
@Model.Children.Where(item => item.shouldBeFeatured);
//Lambda's cannot be used against Dynamic Objects
Ah ok, not too sure how it should work - sorry. Hopefully someone else can jump on this with better knowledge. :-)
is working on a reply...