1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / custom news view - only display 1 article

custom news view - only display 1 article

2 posts, 0 answered
  1. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    26 Jun 2009
    Link to this post
    Hi

    i have a site with a news items and news details

    however, i need a seperate control on the homepage which just shows the last news item in a particular category

    its going to be formatted differently from the news items page, so it needs to be a seperate control

    any ideas what needs to be done?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    26 Jun 2009
    Link to this post
    Hello Quade,

    You need to add the following logic in your custom control. It will return the last content item create for a GenericContent based module( in this case - for News module)

     
            ContentManager manager = new ContentManager("News"); 
            IList ListOfAllItems = manager.GetContent(0, 1, "Publication_Date DESC"); 
            foreach (IContent cnt in ListOfAllItems) 
            { 
                Response.Write(cnt.GetMetaData("Title")); 
            } 

    I hope this helps.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered