When I try to put .OrderBy("whatever") after the folder.Descendants(), it says that dynamic node list doesn't contain a definition for OrderBy. It says the same thing if I put folder.Children or any other variant. Any solution?
That is exactly where I have lived for the last 5 years, I know those towns very well.
I am now on the other coast to the north of Sagres and it is even nicer, less people and beautiful coastline.
What I am trying to bring to here is using technology to connect local businesses to the target markets, ie tourists with mobile devices, at times it is a big struggle, but hopefully soon the benefits will be seen and it can move forward.
Ordering media in razor
Umbraco 6. Trying to order the contents of a media folder, but the macro doesn't build. Here's the relevant code so far.
When I try to put .OrderBy("whatever") after the folder.Descendants(), it says that dynamic node list doesn't contain a definition for OrderBy. It says the same thing if I put folder.Children or any other variant. Any solution?
Hi
Maybe you need to cast the dynamic?
@foreach (dynamic mediaObject in folder.Descendants())
you may also need to check your @using statements, you may need to add something, sorry, do not use webforms so am no expert in that area.
Hope it can move you a little way forward.
Regards
Gary
Cast the dynamic.... Ok, cast it to what?
Hi
on the foreach use dynamic and not var as above.
Have had this problem in the past and it may help
G
Ahhhh, it worked! Muchas gracias.
EDIT: To clarify for anyone else that might find this, I changed "var folder" to "dynamic folder" in the code above.
Muito obrigado, o prazer é meu, porta-se bem.
Sometimes 2 heads are better than one?
G
Indeed. Also, just discovered that there is no implementation of OrderByDescending. But folder.OrderBy("propertyName desc") seems to work.
Lovely place btw, the Algarve. Traveled through Lagos, Salema and Sagres a year ago.
You could also order media items by id
Hi Chrishtoph
That is exactly where I have lived for the last 5 years, I know those towns very well.
I am now on the other coast to the north of Sagres and it is even nicer, less people and beautiful coastline.
What I am trying to bring to here is using technology to connect local businesses to the target markets, ie tourists with mobile devices, at times it is a big struggle, but hopefully soon the benefits will be seen and it can move forward.
Hope to speak again soon
Regards
Gary
is working on a reply...