Answers for "Kentico 9 - Sorting pages in the content tree"

C#
0

Kentico 9 - Sorting pages in the content tree

// Creates an instance of the Tree provider
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

// Gets the parent page
TreeNode page = tree.SelectNodes()
    .Path("/Articles")
    .OnCurrentSite()
    .Culture("en-us")
    .FirstObject;

if (page != null)
{
    bool orderIsAscending = true;

    // Sorts all child pages under the specified parent page alphabetically in ascending order
    tree.SortNodesAlphabetically(page.NodeID, SiteContext.CurrentSiteID, orderIsAscending);

    // Sorts all child pages under the specified parent page ascendingly based on the last modification date
    tree.SortNodesByDate(page.NodeID, SiteContext.CurrentSiteID, orderIsAscending);
}
Posted by: Guest on June-25-2021

Code answers related to "Kentico 9 - Sorting pages in the content tree"

C# Answers by Framework

Browse Popular Code Answers by Language