Go to Site Actions => Site Settings => Look and Feel => Navigation => Sorting.

Programmatically Enable/Disable Sorting for navigation
using (SPSite siteCollection = new SPSite("http://servername:1111/sites/sample"))
{
using (SPWeb web = siteCollection.RootWeb)
{
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
// Sorting
// Do sorting
publishingWeb.Update();
}
}
########################################################################################################
// Sort manually

publishingWeb.Navigation.OrderingMethod = OrderingMethod.Manual;
//Sort manually with automatic paging

publishingWeb.Navigation.OrderingMethod = OrderingMethod.ManualWithAutomaticPageSorting;
//sort automatically

publishingWeb.Navigation.OrderingMethod = OrderingMethod.Automatic;
//Sort by title
publishingWeb.Navigation.AutomaticSortingMethod = AutomaticSortingMethod.Title;
//Sort by created date
publishingWeb.Navigation.AutomaticSortingMethod = AutomaticSortingMethod.CreatedDate;
//Sort by last modified date
publishingWeb.Navigation.AutomaticSortingMethod = AutomaticSortingMethod.LastModifiedDate;
//Sort by ascending order
publishingWeb.Navigation.SortAscending = true;
//Sort by descending order
publishingWeb.Navigation.SortAscending = false;

Join the conversation! Your thoughts help the community grow.