Umbraco Razor - List Subpages from Specific Node - byNodeId - Liist Lates News - Get Node By Id

@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.NodeFactory

@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (Model.NodeById(1850).Children.Any())
{
<div class="sideBarWidget">
<h2><a style="color:#ffffff" href="@Model.NodeById(1850).Url" title="News">Scottish Medical Training<br />Latest News</a></h2>


    <ul>          
        @* For each child page under the root node, where the property umbracoNaviHide is not True *@


         @foreach (var childPage in Model.NodeById(1850).Children.OrderBy("newsArticleDate descending").Take(4))
       {
            <li>
               <a href="@childPage.Url">@childPage.newsArticleTitle</a>  -  @childPage.newsArticleDate.ToString("dd MMM yyyy")
            </li>
        }
    </ul>
</div>
}

Comments

Popular posts from this blog

Umbraco Razor Sort Nodes Ascending or Descending

Umbraco Razor get Querystring

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco