I am having trouble using .OrderByDescending("Id") in sorting items before running throug items to render html.
My code works without .OrderByDescending("Id") but adding does not throw error but only shows blank rendering in browser:
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var folderId = Model.GetPropertyValue("mediaFolder");
var chosenMedia = Model.MediaById(@folderId).OrderByDescending("Id");
if (chosenMedia.NodeTypeAlias == "Folder")
{
foreach (var img in chosenMedia.Children)
{
if (img.NodeTypeAlias == "Image")
{
<div>
Navn: @img.name
<img src="@img.umbracoFile" width="700px" />
</div>
}
}
}
.OrderByDescending("Id")
I am having trouble using .OrderByDescending("Id") in sorting items before running throug items to render html. My code works without .OrderByDescending("Id") but adding does not throw error but only shows blank rendering in browser:
}
.Children.OrderBy("Name")
works fine..Children.OrderByDescending("Name")
does not.Hi Guy
I think you should put the OrderByDescending on your look rather than in your chosenMedia variable so the code looks like this instead
Does that work?
/Jan
In Umbraco version 7.2.1 assembly: 1.0.5462.37503 use:
This does not work.
is working on a reply...