If you just want to reverse the default order as it appears in the content tree:
@Model.Children.OrderBy("id descending")
Use the OrderBy() method to order your list by a specific property (internal or custom) - don't think there is a way natively to reverse the order but you could always write your own extension method if you really need this feature.
Reverse this list in Razor
Hi,
I have this list which goes through the child nodes and lists out the content, I want the order reverse though, does anyone know how to do that?
Thanks,
Simon
Should work.
Thanks,
That didnt work, thank you for your input though
Simon
Thanks,
That didnt work, thank you for your input though
Simon
Thanks,
That didnt work, thank you for your input though
Simon
If you just want to reverse the default order as it appears in the content tree:
@Model.Children
.OrderBy("id descending")Use the OrderBy() method to order your list by a specific property (internal or custom) - don't think there is a way natively to reverse the order but you could always write your own extension method if you really need this feature.
This works for me, but not for Children:
Mark.
is working on a reply...