Umbraco Razor Sort Nodes Ascending or Descending
Descending:
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.cms.businesslogic.template;
@foreach(var item in Model.Children.OrderBy("Name descending"))
{
if(item.HasAccess())
{
@item.Name
}
}
Ascending:
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.cms.businesslogic.template;
@foreach(var item in Model.Children.OrderBy("Name"))
{
if(item.HasAccess())
{
@item.Name
}
}
Comments
Post a Comment