Print RadPane

13 posts, 1 answers
  1. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 11 Jan 2012 Link to this post

    I just want to print the content in the radpane. I tried options provided in other thread but getting error. There are links in those threads which are erroring out. I like know the right way/ right javascript code to do print with any scripts which needed to be included to get it working.

    Below is my code
    <script type="text/javascript">
        function PrintPane(paneID)
        {
          var splitter = <%= RadSplitter1.ClientID %>;
          alert(paneID);
          var pane = splitter.GetPaneById(paneID);
          if (!pane) return;
          pane.Print();
        }
    </script>
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 11 Jan 2012 Link to this post

    Hello Vijaianand,

    I don't know if this is causing your issue, but with javascript being case-sensitive. The method call, GetPaneById, should be getPaneById.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2012 Link to this post

    Hello,

    Take a look into the following documentation.
    Printing Pane Content

    Thanks,
    Princy.
  5. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 12 Jan 2012 Link to this post

    Hello

    @Kevin, all the examples in the forum gives GetPaneById only. So thats why I am using it.
    @Princy, Please read my question with the code. I already have the code but trying to say its not working.  It is giving object not find on GetPaneById
  6. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 12 Jan 2012 Link to this post

    Actually, i made a mistake in find the splitter client id, I fixed that line
    var splitter = $find('<%=RadSplitter1.ClientID %>');

    No error now. but still printing is not working. It just not doing anything at the end. 
  7. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 12 Jan 2012 Link to this post

    Hi Vijaianand,

    According to the error, that you have already noticed yourself, I believe the examples that you have found are for RadSplitter Classic, that is why the GetPaneById() and Print() methods are capitalized, but this should not be the problem because RadSplitter for ASP.NET AJAX have those methods too.

    I tried the sample from the help article that Princy linked and I was able to to print the panes content without any errors. For your convenience I have attached my sample page, could you please modify it to a point where the problem occurs and send it back?

    In addition, in your initial post you are mentioning dead links - "There are links in those threads which are erroring out". Could you please point those thread so we can try to provide the correct links (if possible).

    Greetings,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  8. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 12 Jan 2012 Link to this post

    Hi

    Actually its not RadPane, its RadSlidingPane. So I am not sure that may be the issue. Is it possible print slidingpane? I thought it should be same as RadPane.
    There are lots of dead links you can find when you and search for "RadPane Printing" in the form.

    Vijai
  9. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 12 Jan 2012 Link to this post

    Hi Vijai,

    RadSlidingPane does not offer the possibility to print its content out-of-the-box, nevertheless, you can use the following function to achieve the required result:
    function printSlidingPaneContent(slidingPaneId, arrCssFiles)
    {
        var sPane = $find(slidingPaneId);
        var sFeatures = 'width=' + sPane.get_width() + 'px, height=' + sPane.get_height() + 'px, scrollbars=1';
        var previewWndUrl = 'about:blank';
        var previewWnd = window.open(previewWndUrl, '', sFeatures, false);
     
        //CSS files to be included in the popup window
        var styleStr = "";
        if (arrCssFiles) {
            styleStr = "<head>";
     
            for (var i = 0, length = arrCssFiles.length; i < length; i++) {
                styleStr += "<link href = '" + arrCssFiles[i] + "' rel='stylesheet' type='text/css'></link>";
            }
            styleStr += "</head>";
        }
     
        var popupContent = styleStr + "<body>" + sPane.getContent() + "</body>"
     
        previewWnd.document.open();
        previewWnd.document.write(popupContent);
        previewWnd.document.close();
     
        previewWnd.print();
    }

    For your convenience I have attached a sample page demonstrating this approach.

    Greetings,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  10. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 12 Jan 2012 Link to this post

    That works except the height and width from Slidingpane is properly getting it. It set to Min width and height..

    Thanks. May be should have searched for SlidingPane print instead of RadPane. 
  11. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 15 Feb 2012 Link to this post

    Hi

    I am having issue with this solution when the RadSlidePane has iframe. It is not taking iframe content to print. How can we fix that issue? I was thinking may be take the content of the page which is iframed and add in the popcontent but I was wondering any other solution possible.

    Vijai
  12. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 20 Feb 2012 Link to this post

    Hi Vijai,

    In general, the printing functionality is controlled by the browser and the OS and cannot be modified programmatically.

    RadSplitter does not offer the functionality to display external content inside its sliding panes, and does not offer functionality to access the content of <iframe> elements out-of-the-box.

    If you are using an <iframe> to display external content inside RadSlidingPane you need to manually extract the content of this <iframe> and add it to the preview's popup window. However, accessing the content of an <iframe> element is not always possible because of a security restriction in JavaScript - you cannot access content of an <iframe> if the page displayed inside it is from different domain.

    Regards,
    Dobromir
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  13. Vijaianand
    Vijaianand avatar
    82 posts
    Member since:
    Jul 2012

    Posted 21 Feb 2012 Link to this post

    ok! I know RadSplitter don't support print and thats why I am trying different ways.

    So if I understand correctly, I won't be to able to extract content from iframe if the url is from different domain but if its same domain it is possible? I tried many ways using javascript, jquery to extract it out but still no luck. Do you have any code sample?
  14. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 24 Feb 2012 Link to this post

    Hi Vijai,

    Please review the following RadEditor's Demo.
    http://demos.telerik.com/aspnet-ajax/editor/examples/customdialogs/defaultcs.aspx

    The custom PrintPreview dialog is using an IFrame and prints its content.

    Regards,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017