Daniel is correct. There is no point to call OrderBy after you have called FirstOrDefault. The FirstOrDefault extension method will give you the first item of the collection or null if the collection is empty.
So remake your query by removing the FirstOrDefault at the end:
Is it possible to define a sorting by custom field of dynamic content in RadListView control?
I've defined a custom content in Module Builder with two additional fields Title and Description. How can I define sort in RadListView control by Title field? The following code of widget template for this content produces an exception with message "Invalid property or field - 'Title' for type: DynamicContent".
You should set the sorting from the Widget Properties itself.
Just fill in the SortExpression field in the widget advanced settings (see screenshot). This can be found within the Advanced Settings -> ControlDefinition > Views > DynamicContentMasterView
Pavel, can I use filter expression language to define custom sort order? Where I can find complete reference for filter expression language described on following link?
What means Taxonomy ID in expression Visible = true AND Status = Live AND Category.Contains("Taxonomy ID") ?
Above Daniel Plomp Code will working fine for me when i am doing sorting for string field like Name, Title,...
When we required sorting the number value(s) having string datatype then above code wont help. need to do work around to get the proper list value below is my working sample code.