Try Now
More in this section

Forums / Deployment / Sort Forum by Created Date

Sort Forum by Created Date

2 posts, 0 answered
  1. bnye
    bnye avatar
    332 posts
    22 Sep 2005
    15 Jul 2010
    Link to this post
    It looks like the forum list can only be sorted alphabetically. Is that correct?

    I've been away from Sitefinity for a while so you'll have to bear with me if this question has been answered.


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    25 Oct 2016
    15 Jul 2010
    Link to this post
    Hello bnye,

    There are only two methods of ForumManger class that support sorting

    GetPosts(Guid parentID, bool descending, bool visibleOnly) - Gets all child posts of the specified parent. If the second parameter is true you will get results sorted in descending order

    The second method gets only categories in a sorted order -GetCategories(string sortExpr)

    The only way to have some sorting is creating a custom data provider and using SQL-LINQ to sort the list of IPosts that is returned


    public class ForumDataProviderCustom : Telerik.Forums.Data.DefaultProvider
        public override IList GetForums(ICategory category, bool excludeHidden)
           // return base.GetForums(category, excludeHidden);
            List<IForum> customList = new List<IForum>();
            IList list = base.GetForums(category, excludeHidden);
            foreach (IForum forum in list )
             // here use LINQ to sort the list and finally return it

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered