Printing Multiple RadPage Views on one Click

2 posts, 0 answers
  1. Mohammad
    Mohammad avatar
    7 posts
    Member since:
    Nov 2013

    Posted 15 Sep 2015 Link to this post

    Hi,

        We've implemented a TabStrip with multiple tabs and content residing in PageViews of Multipage control. We would like to print all content from each pageview when a button is clicked. We want each pageview to be printed in a separate page. I tried selected pageview print from this

      It worked perfectly for selected views. I modified the code to append innerHMTL as shown below and i am getting 'undefined' as text in print instead of actual content. Is there a way to print multiple pages in one go irrespective of which tab is active? 

      function printPageView() {
                    var myPageView = $find('<%= RadMultiPage1.ClientID %>');
                      var myIframe = document.getElementById('ifrmPrint');
                      var pvContent = "" // myPageView.get_pageViews().innerHTML;

                      var multiPage = $find("<%=RadMultiPage1.ClientID %>");
                      var i;
                      for (i = 0; i < myPageView.get_pageViews().get_count() ; i++) {
                         // alert(multiPage.get_pageViews().getPageView(i).get_id());
                          pvContent += multiPage.get_pageViews().getPageView(i).innerHTML;
                      }


                      var myDoc = (myIframe.contentWindow || myIframe.contentDocument);
                      if (myDoc.document) myDoc = myDoc.document;
                      myDoc.write("<html><head><title>title</title>");
                      myDoc.write("</head><body onload='this.focus(); this.print();'>");
                      myDoc.write(pvContent + "</body></html>");
                      myDoc.close();
                  }

  2. Mohammad
    Mohammad avatar
    7 posts
    Member since:
    Nov 2013

    Posted 16 Sep 2015 in reply to Mohammad Link to this post

    Never mind... I was missing get_element() function. For those who are in need here is the code.

    function printPageView() {
    var myPageView = $find('<%= RadMultiPage1.ClientID %>');
    var myIframe = document.getElementById('ifrmPrint');
    var pvContent = ""
    var multiPage = $find("<%=RadMultiPage1.ClientID %>");
    var i;
    for (i = 0; i < myPageView.get_pageViews().get_count() ; i++) {
    pvContent += multiPage.get_pageViews().getPageView(i).get_element().innerHTML
    }
    var myDoc = (myIframe.contentWindow || myIframe.contentDocument);
    if (myDoc.document) myDoc = myDoc.document;
    myDoc.write("<html><head><title>title</title>");
    myDoc.write("</head><body onload='this.focus(); this.print();'>");
    myDoc.write(pvContent + "</body></html>");
    myDoc.close();
    }

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top