More in this section

NewsManager

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. Princely
    Princely avatar
    4 posts
    Registered:
    06 Aug 2008
    20 Aug 2008
    Link to this post
    I'm trying to get a list of all of my news item through a custom control.
    Everything is working fine, but my question is:
    Is it possible to sort the list?
    I think normal sort order is modified by....

    Is it possible to sort IList listOfNewsItems by "Title" or "Category", then how?
    Here is my code:

    Telerik.News.NewsManager newsManager = new Telerik.News.NewsManager("News");
    IList listOfNewsItems = newsManager.Content.GetContent();
    if (listOfNewsItems.Count > 0)
    {
        foreach (Telerik.Cms.Engine.IContent newsItem in listOfNewsItems)
        {
            NetmediaPanel1.Text += newsItem.GetMetaData("Title") + "<br />";
            NetmediaPanel1.Text += newsItem.Content.ToString() + "<br /><br />";
        }
    }
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Aug 2008
    Link to this post
    Hello Princely,

    You can get the list of all content objects ordered by sorting expression GetContent(string sortExp).

            Telerik.News.NewsManager newsManager = new Telerik.News.NewsManager("News"); 
            IList listOfNewsItems = newsManager.Content.GetContent("Category ASC"); 
            if (listOfNewsItems.Count > 0) 
            { 
                foreach (Telerik.Cms.Engine.IContent newsItem in listOfNewsItems) 
                { 
                    NetmediaPanel1.Text += newsItem.GetMetaData("Title") + "<br />"; 
                    //news1.Text += newsItem.GetMetaData("Category") + "<br />"; 
                    NetmediaPanel1.Text += newsItem.Content.ToString() + "<br /><br />"; 
                } 
            } 


    You can get items ordered by one meta key only. For instance key could be "Title" or "Category".

    I hope this helps.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. Princely
    Princely avatar
    4 posts
    Registered:
    06 Aug 2008
    21 Aug 2008
    Link to this post
    Superb, thanx!

Register for webinar
3 posts, 0 answered