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

Forums / Developing with Sitefinity / "Latest News" Module

"Latest News" Module

10 posts, 0 answered
  1. Developer
    Developer avatar
    4 posts
    Registered:
    06 Aug 2008
    12 Aug 2008
    Link to this post
    Hello Everyone,

    Has anyone found a way to modify the News module to display only the most recent news item? For example, this site I'm working on transitioning to Sitefinity has a link for "Latest News". When the user clicks on this it is intended to open only the most recent news item in full view (as opposed to summary view). It seems like it ought to be fairly simple, but I haven't yet been able to find a way to do this. Any ideas?

    Thank you in advance!
    Charles
  2. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    13 Aug 2008
    Link to this post
    Hello Developer,

    Take a look at the following KB article: How to display news published within the last month
    Apart from guidelines on how to achieve this functionality, the article also contains a code sample.

    Let us know if you have further questions.


    All the best,
    Sonya
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Developer
    Developer avatar
    4 posts
    Registered:
    06 Aug 2008
    14 Aug 2008
    Link to this post
    Thank you, your response was extremely helpful! That gives me a good base from which to work.

    Sincerely,
    Charles
  4. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    14 Aug 2008
    Link to this post
    Hello Developer,

    We are always glad to be able to help. Let us know if there is anything else we can do for you.

    Sincerely yours,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Developer
    Developer avatar
    4 posts
    Registered:
    06 Aug 2008
    14 Aug 2008
    Link to this post
    I'm afraid I have another issue after implementing the proposed solution. This also is probably very simple, but this is my first endeavor with C#, so I'm learning as I go...

    After implementing the control suggested in the Knowledge Base article, I receive an error related to the assembly. The control shows up in my Control List, but it generates the following error:
    "Could not load type 'Telerik.News.WebControls.LatestNews' from assembly 'App_Code'.
  6. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    18 Aug 2008
    Link to this post
    Hi Developer,

    I am afraid there may be a mistake in our KB. Can you please try to replace this line:
    <add name="Latest News" section="News" type="Telerik.News.WebControls.LatestNews, App_Code"/>     
    with this line:
    <add name="Latest News" section="News" type="Telerik.News.WebControls.LatestNews"/>     
    Basically, remove the "App_Code" part.

    I hope this will solve your problem. Let us know how it goes and if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Developer
    Developer avatar
    4 posts
    Registered:
    06 Aug 2008
    21 Aug 2008
    Link to this post
    I'm afraid this still has not resolved the issue. Is it possible that I have not placed the .cs file in the correct location? I placed the file LatestNews.cs in the folder:
    ...\telerik\Sitefinity3.2\WebSites\MyTestSite\Sitefinity\UserControls

    Should it be located in a different place? The line in the web.config file is exactly as you indicated it should be:
    <add name="Latest News" section="News" type="Telerik.News.WebControls.LatestNews"/> 

    Thank you for your continued assistance with this issue.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Aug 2008
    Link to this post
    Hi Developer,

    Thank you for contacting us.

    In order to implement this control please do the following:

    1. Create "App_Code" folder in your project root. Please find the attached screenshot.
    2. Add the ".cs" file in App_Code folder.
    3. Edit your web.config file  <toolboxControls> tag section and add the following line.

    <add name="Latest News" section="News" type="Telerik.News.WebControls.LatestNews, App_Code"/> 

    4. Save and test.

    The control will be added under "News"  toolbox Control section.

    Please let me know about the result and thank you for using our services.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    14 May 2010
    Link to this post
    Hello,

    I'm trying to use this code with 3.7 SP3 and am getting the following error:

    Invalid resource name (Telerik.News.Resources.ControlTemplates.Frontend.Modes.ListPageMaster.ascx) for assembly (App_Code.uwjjtz5a, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) or empty template.


    Has something changed with the newer version that is causing this error to be thrown or have I overlooked something else? Thanks.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    14 May 2010
    Link to this post
    Hello Philip Senechal,

    You should override  the properties shown below and set the template that your control will use. You can download all templates from your account  >> Downloads section. There is an archive of external templates

    public override string ItemListTemplatePath
        {
            get
            {
                return "~/Sitefinity/ControlTemplates/News/ListPageMaster.ascx";
            }
     
        }
     
        public override string SingleItemTemplatePath
        {
            get
            {
                return "~/Sitefinity/ControlTemplates/News/ListPageDetails.ascx";
            }
     
        }
     
        public override Type LocalizationAssemblyInfo
        {
            get
            {
                return this.GetType();
            }
            set
            {
                base.LocalizationAssemblyInfo = value;
            }
        }
     
        public override Type AssemblyInfo
        {
            get
            {
                return this.GetType();
            }
            set
            {
                base.AssemblyInfo = value;
            }
        }


    Regards,
    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.
Register for webinar
10 posts, 0 answered