This is a migrated thread and some comments may be shown as answers.

printer-friendly pageview?

4 Answers 102 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 10 Jun 2008, 09:02 PM
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.).

4 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 12 Jun 2008, 01:28 PM
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
0
Amber
Top achievements
Rank 1
answered on 10 Feb 2010, 04:45 PM
Very nice!

Thanks!
0
Prabha
Top achievements
Rank 1
answered on 11 Mar 2014, 04:26 PM
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.
0
Shinu
Top achievements
Rank 2
answered on 12 Mar 2014, 04:34 AM
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.
Tags
TabStrip
Asked by
Dave
Top achievements
Rank 1
Answers by
Paul
Telerik team
Amber
Top achievements
Rank 1
Prabha
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or