Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm listing the children of a page as follows:
var page = Umbraco.Content(FolderId); var vPageName = page.name; foreach (var child in page.Children)
How do I put the children in descending order using a date property?
Your help would be much appreciated.
Thanking you in anticipation.
Roger
Hi Roger,
What you can do is to add .OrderBy to your foreach statement, so your code should look something like this,
var page = Umbraco.Content(FolderId); var vPageName = page.name; foreach (var child in page.Children.OrderBy("date desc"))
Where "date" is the property alias of your date field. If you use "CreateDate", then you will sort on when the pages, was created.
Hope this helps,
/Dennis
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Order items by a date property
I'm listing the children of a page as follows:
How do I put the children in descending order using a date property?
Your help would be much appreciated.
Thanking you in anticipation.
Roger
Hi Roger,
What you can do is to add .OrderBy to your foreach statement, so your code should look something like this,
Where "date" is the property alias of your date field. If you use "CreateDate", then you will sort on when the pages, was created.
Hope this helps,
/Dennis
is working on a reply...