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

Forums / Developing with Sitefinity / Printer Page for Blog Post

Printer Page for Blog Post

8 posts, 0 answered
  1. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    17 Jan 2010
    Link to this post
    I have a blog post that I have setup you see the summary then click on the summary to see the full post.

    Once you get to the page with the full post on it how do I put a link on the page with the full post that will pull up a page that is just text. Take out all underlines and images.

    I am trying to make a printer friendly version. I want a button or link that says printer friendly that pulls the story in a printer/reader friendly format.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 Jan 2010
    Link to this post
    Hello Steven Lancaster,

    You can use JavaScript and  window.print() method. When you call this method  the whole page content will be printed. You can create two versions of page, one for displaying the full content and another that shows only your print version of an item. You can create an input button as shown below:

    <input type="button" value="Print" onclick="window.open('PrintThisContent.aspx')" />

    As you can see firs we open a new window with our PrintThisContent page where you have to call window.print();. This javascript will execute when page loads and you do not need an additional button.


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    18 Jan 2010
    Link to this post
    That works well, but how do I use that to pull the story/post that I am on.

    For example I have a page with a list of posts you click there get the single full post add the button in so that it pulss the spost that I clicked on not just the last one?

    This may be a different question. So do I need to create a .ascx and a .ascx.cs file to drive it and what would the code be for that?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    In this case you can add the button in ListPageDetails mode template of the NewsView control and use jQuery to get the element that shows the news items content ( or the whole news item).You may find the following article  useful - Selectors/element

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    19 Jan 2010
    Link to this post
    I am sure this is pretty common request. Can you give me some sample code?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    1.Go to jQuery and download this plugin http://plugins.jquery.com/project/printElement
    2. Map ListPageDetails.ascx external template and implement js function and button that calls it.

    <script type="text/javascript">
        function PrintContent() {
            $("div#myPrintArea").printElement();
     
        }
    </script>
     
    <asp:Button  runat="server" id="print_button" Text="print"  OnClientClick="PrintContent();"></asp:Button>
    <div class="sf_singleNews">
    <div id="myPrintArea">
        <asp:HyperLink ID="backToList1" Text="<%$Resources:AllNews %>" CssClass="sf_back" runat="server"></asp:HyperLink>
        <h2 class="sf_NewsTitle">
            <asp:Literal ID="Title" runat="server"></asp:Literal>
             <asp:Literal ID="linkit" runat="server"></asp:Literal>
        </h2>
        <p class="sf_newsDate">
            <asp:Literal ID="Publication_Date" runat="server" Text="{0}" />
        </p>
        <p>
            <asp:Literal ID="Summary" runat="server"></asp:Literal>
        </p>
        <p>
            <asp:Literal ID="content" runat="server"></asp:Literal>
        </p>
        <p class="sf_newsAuthor">
            <asp:Literal ID="Author" runat="server"></asp:Literal>
        </p>
        <p>
            <asp:Literal ID="Source" runat="server"></asp:Literal>
        </p>
        <p class="sf_postCategory">
            <asp:HyperLink ID="Category" runat="server" />
        </p>
         
        <asp:Repeater ID="Tags" runat="server">
            <HeaderTemplate><p class="sf_postTags"></HeaderTemplate>
            <ItemTemplate>
                <asp:HyperLink ID="tagLink" runat="server" />
            </ItemTemplate>
            <FooterTemplate></p></FooterTemplate>
        </asp:Repeater>
    </div>

    Generally this does not have anything to do with Sitefinity itself  or its API.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    19 Jan 2010
    Link to this post
    Thanks Ivan, but I believe I am not explaining exactly what I am wanting. Let me try again.

    I have stories on our reports blog. I want the user to click a button or hyperlink on the full story and open another page and it be more readable as far as online also it would be printer friendly. so just a rundown.

    I have a set of stories that you can see on a summary page. You click on a read more/hyperlink and bring up the full story ONCE you bring up the full story I want them to click on a button or hyperlink to a new page with the same information just without the navigation and so forth on the page so that it almost look lie an article. Another option is being able to turn the story into a PDF without the navigation and such. I just need to be able to bring up a seperate page that is more reader/printer friendly.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Jan 2010
    Link to this post
    Hello Steven Lancaster,

    You should have a new page on which you have a custom control that shows only the needed information from your ContentView control. You can pass the content ID as a querystring and your custom control will read it. Then display the IContent data.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
8 posts, 0 answered