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

Print from RadWindow Titlebar IE11

5 Answers 37 Views
Window
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 24 Aug 2014, 11:50 PM
Had the following example working fine to print contents of a Radwindow from the title bar:  http://www.telerik.com/support/kb/aspnet-ajax/window/details/adding-a-custom-button-to-radwindow-titlebar

However now using IE11 it prints the entire page behind the window as well.
In Firefox works fine and only prints the contents of the Radwindow.

Would appreciate and any.

Thanks

Glenn

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 26 Aug 2014, 11:59 AM

Hello  Glenn,

What is important is that the correct context is used when the print() command is executed. The browser detemines this and prints that page. The sample shows how to get the RadWindow iframe's object and this article expands on the matter of calling functions in the different contexts: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html.

You may also find useful the examples from this KB article as well because it treats printing in more detail: http://www.telerik.com/support/kb/aspnet-ajax/window/details/printing-the-contents-of-a-radwindow. What is important is that we do not and cannot control the way the browser interprets this command and the best advice I can provide is to test out this KB too and to see how your IE behaves with a simple iframe instead of a RadWindow.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Glenn
Top achievements
Rank 1
answered on 27 Aug 2014, 11:45 PM
Seems it's an IE11 problem as per this:
if(document.all)
 {
     //IE 6/7/8/9/10 will run this
 }
 else
 {
     //chrome, firefox, IE11 will run that
 }

FROM: http://www.julien-manici.com/blog/important-compatibility-changes-in-IE11-on-Windows-8-1/

Seems working now on IE11 and Firefox by changing to:
function CheckIsIE11() {
       if (Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject) {
           // is IE11
           alert("true");
           return true;
       }
       alert('false');
       return false;
   }
 
   function printWin(e) {
       var oManager = GetRadWindowManager();
       var oWnd = oManager.GetWindowByName("RadWindowPreview");
       var content = oWnd.GetContentFrame().contentWindow;
       var printDocument = content.document;
       if (document.all || CheckIsIE11()) {
           alert('ie');
           printDocument.execCommand("Print");
       }
       else {
           alert('other');
           content.print();
       }
       //Cancel event! 
       if (!e) e = window.event;
       return $telerik.cancelRawEvent(e);
   }

Can you see any issue using this change?

Thanks

0
Accepted
Marin Bratanov
Telerik team
answered on 29 Aug 2014, 10:23 AM

Hello Glenn,

As long as the browser detection you have in place work for your needs, I do not see issues with the approach.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Matt
Top achievements
Rank 1
answered on 07 Nov 2014, 04:29 PM
I wish I could have found this post easier.  Please link it to the KB article about adding a print button to a RadWindow.

Thanks!
0
Marin Bratanov
Telerik team
answered on 10 Nov 2014, 02:14 PM

Hi Matt,

Here is the KB: http://www.telerik.com/support/kb/aspnet-ajax/window/details/adding-a-custom-button-to-radwindow-titlebar. You can use that button to call the functions that will print the needed contents: http://www.telerik.com/support/kb/aspnet-ajax/window/details/printing-the-contents-of-a-radwindow.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Glenn
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Glenn
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or