Hello Everyone! I am currently using v4.7.0 and I have a page that lists all of my "members" wich is actually a list of teachers. I want to display them on this page in order of their last name. I was hoping that the code below would allow me to do this however I get an error.
var members = Member.GetAll; foreach(var item in members.OrderBy("facultyLastName desc")){ var facultyFname = item.getProperty("facultyFirstName").Value.ToString(); var facultyLname = item.getProperty("facultyLastName").Value.ToString(); ...
The error I get is...
Error loading Razor Script .......\Umbraco\App_Data\TEMP\Razor\inline-8c470d31e3635414de480b6d98382976.cshtml(245):
error CS0411: The type arguments for method
'System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Ok that worked.. Thanks Sebastiaan Janssen, but I guess I need it Ascending so that last names starting with "A" come first. If I change OrderByDecending to OrderByAscending I get an error.
error CS1061: 'System.Array' does not contain a definition for 'OrderByAscending' and no extension method 'OrderByAscending' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
OrderBy a Specific Value - Members in Razor
Hello Everyone!
I am currently using v4.7.0 and I have a page that lists all of my "members" wich is actually a list of teachers. I want to display them on this page in order of their last name. I was hoping that the code below would allow me to do this however I get an error.
The error I get is...
I'm not sure if my code is wrong or if I fall into the problem listed here:
http://our.umbraco.org/forum/developers/razor/19400-OrderBy-not-working?p=0
If I do fall into that I guess I'll have to wait till v4.7.1 until I can get it fixed :-(
I think the members collection can be ordered like this:
Ok that worked.. Thanks Sebastiaan Janssen, but I guess I need it Ascending so that last names starting with "A" come first. If I change OrderByDecending to OrderByAscending I get an error.
error CS1061: 'System.Array' does not contain a definition for 'OrderByAscending' and no extension method 'OrderByAscending' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
Is sorting it that way done differently?
Nevermind... duh... just "OrderBy"... thanks!
is working on a reply...