printer-friendly pageview?

5 posts, 0 answers
  1. Dave Durose
    Dave Durose avatar
    44 posts
    Member since:
    Jan 2008

    Posted 10 Jun 2008 Link to this post

    I have a RadTabStrip which contains a multipage and several pageviews within that.  Is there an easy way to get a printer-friendly version of one of my pageviews?  In other words, I'd like to give the user a printer icon they can click on and that would in turn allow the user to just print off that one pageview instead of the whole page (i.e. get rid of the surrounding page content, tabstrip, etc.).
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 12 Jun 2008 Link to this post

    Hello Dave,

    Please find below a sample code snippet that shows the needed approach.

    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 
     
        <script type="text/javascript">  
        function printPageView()  
        {  
            var myMultipage = $find('<%= RadMultiPage1.ClientID %>');                 
            var oIframe = document.getElementById('ifrmPrint');  
            var oContent = myMultipage.get_selectedPageView().get_element().innerHTML;  
            var oDoc = (oIframe.contentWindow || oIframe.contentDocument);  
            if (oDoc.document) oDoc = oDoc.document;  
                    oDoc.write("<html><head><title>title</title>");  
                    oDoc.write("</head><body onload='this.focus(); this.print();'>");  
                    oDoc.write(oContent + "</body></html>");          
                    oDoc.close();            
        }  
        </script> 
     
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">  
            <Tabs> 
                <telerik:RadTab runat="server" Text="Root RadTab1">  
                </telerik:RadTab> 
                <telerik:RadTab runat="server" Text="Root RadTab2">  
                </telerik:RadTab> 
            </Tabs> 
        </telerik:RadTabStrip> 
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server">  
            <telerik:RadPageView ID="RadPageView1" runat="server">  
                RadPageView1<br /> 
                <br /> 
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vel sem at tellus iaculis vestibulum! Cras consequat euismod nisi. Nullam eros nibh, dignissim non, cursus eget, elementum dignissim, turpis. Sed nibh elit, volutpat id, auctor eget, molestie sit amet, turpis. Cras justo metus, vehicula vitae, tincidunt vitae, scelerisque tempor, pede. Morbi ullamcorper laoreet neque. Etiam pulvinar rhoncus ante? Cras vulputate, dui vitae mollis blandit, nulla felis consequat eros, et dapibus purus nibh id augue. Suspendisse euismod, purus id semper faucibus, augue ipsum congue leo, quis sagittis neque nibh ut risus! Etiam iaculis.  
            </telerik:RadPageView> 
            <telerik:RadPageView ID="RadPageView2" runat="server">  
                RadPageView2<br /> 
                <br /> 
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vel sem at tellus iaculis vestibulum! Cras consequat euismod nisi. Nullam eros nibh, dignissim non, cursus eget, elementum dignissim, turpis. Sed nibh elit, volutpat id, auctor eget, molestie sit amet, turpis. Cras justo metus, vehicula vitae, tincidunt vitae, scelerisque tempor, pede. Morbi ullamcorper laoreet neque. Etiam pulvinar rhoncus ante? Cras vulputate, dui vitae mollis blandit, nulla felis consequat eros, et dapibus purus nibh id augue. Suspendisse euismod, purus id semper faucibus, augue ipsum congue leo, quis sagittis neque nibh ut risus! Etiam iaculis.  
            </telerik:RadPageView> 
        </telerik:RadMultiPage> 
        <input id="Button1" type="button" value="button" onclick="printPageView()" /> 
        <iframe src="#" style="width: 0; height: 0" id="ifrmPrint"></iframe> 
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">  
        </asp:ContentPlaceHolder> 
    </form> 


    Regards,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Amber
    Amber avatar
    5 posts
    Member since:
    Mar 2007

    Posted 10 Feb 2010 Link to this post

    Very nice!

    Thanks!
  5. Prabha
    Prabha avatar
    1 posts
    Member since:
    Feb 2013

    Posted 11 Mar 2014 Link to this post

    I am having same kind of issue, printing all the pageviews of radtabstrip. could you please tell me how can print all the pages with one button click?

    Thank you.
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Mar 2014 in reply to Prabha Link to this post

    Hi Prabha,

    With reference to this forum thread RadMultipage control does not have such build in functionality that will get the PagveViews and print their content. Please have a look into this help documentation for print the content of the selected RadPageView only.

    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017