I want to print a aspx page but before printing I want to hide some controls from the page and after that I want to show again those controls. I'm using this code:
String scriptText = "<script language='javascript'>";
scriptText += "document.getElementById('textB1').style.visibility = \"hidden\";";
scriptText += "document.getElementById('panel').style.visibility = \"hidden\";";
scriptText += "window.print();";
scriptText += "document.getElementById('textB1').style.visibility = \"visible\";";
scriptText += "document.getElementById('panel').style.visibility = \"visible\";";
scriptText += "</script>";
ClientScript.RegisterStartupScript(this.GetType(), "Print", scriptText);
The problem is that I don't know how windows.print() works because the controls are still visible on my printed page. How to get the right time when the printed page was captured? Only after that, the controls to be set to visible?
setTimeout(function (){...print....},3000)?document.write('asp.net')on a window.onload function do? :)