I have some news items that are sorted by the "Create date" value.
Now that the client are moving all the old news from their old site to this new site I have made a date picker so it's possible for the client to set the old date of the news.
How can I with razor first sort after the date picker I have made and if the client haven't specified a date then sort after the normal "Create date"?
Sort with two different dates
Hi
I have some news items that are sorted by the "Create date" value.
Now that the client are moving all the old news from their old site to this new site I have made a date picker so it's possible for the client to set the old date of the news.
How can I with razor first sort after the date picker I have made and if the client haven't specified a date then sort after the normal "Create date"?
Thanks in advance.
If you have a list that inherits from IQueryable then just use Linq like this:
If you require descendend sorting, the use OrderByDescending and ThenByDescending.
Regards
I'm not using Linq but just normal Razor.
Is it possible when I just have some nodes with my own "Publishdate" value and the "Create date" value and then sort the nodes with Razor?
Just import Linq in your view using
is working on a reply...