I am working on a member list. So far everything works fine. I now want to add sorting on it. I have a custom property on my members that use the numeric datatype in umbraco. The alias on it is sortering. I thought it was a simple as doing .OrderBy("sortering"). Anyway here is my code:
Using Umbraco 7.2.2, when I try to OrderBy I get the following error:
error CS1928: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'OrderBy' and the best extension method overload 'Umbraco.Web.PublishedContentExtensions.OrderBy(System.Collections.Generic.IEnumerable, string)' has some invalid arguments
I have everything setup exactly as in the above example, except that I want to sort on a string field (company). Can anyone help?
Sort memberlist by custom property
Hi guys
I am working on a member list. So far everything works fine. I now want to add sorting on it. I have a custom property on my members that use the numeric datatype in umbraco. The alias on it is sortering. I thought it was a simple as doing .OrderBy("sortering"). Anyway here is my code:
Any ideas? :)
/Michael
Hi Michael,
You will need you use a lambda such as this:
Jeavon
I can get it to work if I add a .ToString() like this:
The problem now is that the number 10-19 gets displayd before number 2. I am guessing it's because it only looks at the first number?
Did you get an error when using it like this?
Ahhh yes, that did it.
Thank you very much Jeavon :D
Brilliant!
I don't think it would help you with what you are doing here but are you also aware of the new MembershipHelper?
Jeavon
No, but now i am. Thank you very much :)
Michael
Using Umbraco 7.2.2, when I try to OrderBy I get the following error:
I have everything setup exactly as in the above example, except that I want to sort on a string field (company). Can anyone help?
Hi Mike,
Could you post your code?
Jeavon
When I try adding the OderBy to GetMembersByGroup("1") I get the error.
is working on a reply...