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

Forums / Developing with Sitefinity / Newsview control and linking directly to a PDF

Newsview control and linking directly to a PDF

3 posts, 0 answered
  1. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    24 Oct 2008
    Link to this post
    Hi there,

    I have a newsView control and was hoping it would be possible to set a news article to go directly to a document (say PDF) when clicking on the title? Rather than go to a page which then has an inserted document. however, I have been instructed by Telerik support that this is not possible.

    Im after some thoughts/direction on how I could custom code this into the newsView control? Perhaps by creating a custom field for the control (allowing the user to enter a URL to the PDF), and in the code behind, programmatically checking that when populated the news article will redirect to this URL.

    Any advice appreciated.

    thanks - matt.
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    24 Oct 2008
    Link to this post
    if you look at the newsList.ascx control template (not in the modes subfolder, but in the regular news folder) you'll see that this control uses regular databinding syntax to bind meta values to the page. you might be able to use this as a base to put in custom meta fields into the title's link.

    just an idea, hope this is helpful!
  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    28 Oct 2008
    Link to this post
    Hi,

    If you are using NewsView control, here is how you can override the control to change its url:

    using Telerik.Cms.Engine; 
    using Telerik.Blogs.WebControls; 
    //  
    namespace Telerik.Blogs.WebControls 
        public class CustomBlogPosts : BlogPosts 
        { 
            protected override string GetItemUrl(IContent contentItem, string singleItemUrl) 
            { 
                return //URL 
     
            } 
             
        } 

    This is a class in App_Code directory.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
3 posts, 0 answered