More in this section

Forums / Developing with Sitefinity / Extending News view

Extending News view

3 posts, 0 answered
  1. Durga
    Durga avatar
    10 posts
    Registered:
    14 Sep 2005
    18 Feb 2009
    Link to this post
    Hi

    I have a news list in my homepage. On clicking on a news entry, i have news article page opening in the same window.

    I have a requirement as follows.
     
    Keep a 'print' button\link in the news article page. Clicking on it should open a friendly version of news article.

    I searched the forum and couldnt find a quick or near-quick solution. (though got good suggestions like use default window.print option and have a new style for printer friendly page)

    Can any one validate if below is possible.

    1. Build a new template with Newsview control which will use printer-friendly styles.
    2. Create a new page based on the new template
    3. This new page should get the news article (unique identifier) as input (query string?) and display the news article

    If above is possible to achieve in Sitefinity (without doing any programming), below are my questions.

    1. I can place a link button in listpagedetails.ascx under news module. But how do i get the url\unique identifier of the news article page? 
    <asp:HyperLink ID="Print" Text="print" Navigateurl = "printpage.aspx?uid=<% ????? %> " runat="server"></asp:HyperLink>

    ?????  = Currentpage.uniqueidentifier

    2.  Is it possible to set a news view control to directly display news article page by passing some input like news article unique identifier. Is there any property setting  i can set at this page level to achieve this?

    Thanks
    Durga

  2. Bob
    Bob avatar
    330 posts
    Registered:
    30 Dec 2016
    24 Feb 2009
    Link to this post
    Hi Durga,

    The best approach is to use CSS media types instead of creating separate printer friendly page. Here are some resources on using CSS media types:
    http://webdesign.about.com/cs/css/a/aa042103a.htm
    http://css-tricks.com/video-screencasts/52-building-a-print-stylesheet/
    http://css-tricks.com/css-tricks-finally-gets-a-print-stylesheet/

    The approach you are suggesting is also applicable. To achieve that, create both display and print pages at the same level in the page hierarchy. For example ~/homepage.aspx and ~/printpage.aspx. Then place the following script in listpagedetails.ascx:
    <script type="text/javascript">  
     
        function OpenPrintVersion() {  
            window.open(document.location.href.replace("/homepage/", "/printpage/"));  
        }  
          
    </script> 
     
    <href="javascript:OpenPrintVersion()">Print</a> 
     

    Since all the information needed to retrieve the same article is already in the URL, you do not need to pass additional parameters.

    Regards,
    Bob
    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.
  3. Durga
    Durga avatar
    10 posts
    Registered:
    14 Sep 2005
    25 Feb 2009
    Link to this post
    Hey Bob

    Thank you very much for your reply.
    I was able to achieve what i needed by apply printer friendly CSS (new theme to hide navigation controls and display only required content area)

    Below forum urls where extremely helpful in getting things done.
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bebgbh.aspx
    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-btbaht.aspx

    Thanks again for this forum and Sitefinity support team.

Register for webinar
3 posts, 0 answered