Visual Studio .NET - Printing - Asked By shuwen chew on 25-Apr-06 11:29 PM

i'm using the "window.print();" to print the page,by clickin a button. But if printing the current windows it will also print out the button(print) as well..any idea that can print without letting people see the button?
example : click a button from previous page but print another page?
click in page A, but print page B
or any other way?
i'm using asp.net
Asked By Rupali Randhave Kolhe on 26-Apr-06 12:10 AM
i m learning  asp.net
I m not sure in asp.net
But in vb i done this.
On click of print button,
first i set visible property of print btn false.
then i set print cmd.
again i set visible prop. to true
Hope this hint will help u.
if u got solution plz. write here

try this for - Asked By Venkat K on 26-Apr-06 12:17 AM

hiding the print button
[CODE]
function doPrint()
{
  if (navigator.appName.indexOf("Microsoft") != -1)
  {
    knop.hide();
    window.print();
    knop.show();
  }
  else
  {
    window.print();
  }
}
</Script>
</HEAD>
<BODY>
<Script Language="Javascript">
  var htmlButton = new String("<input type=button value='Print' onClick='doPrint()'>");
  if (navigator.appName.indexOf("Microsoft") != -1)
  {
    var knop = new NewDiv(window,"button",htmlButton);
    knop.output();
    knop.show();
  }
  else
  {
    document.write(htmlButton);
  }
</script>
<BR>
Demo - Demo - Demo - Demo - Demo - Demo<BR>
Demo - Demo - Demo - Demo - Demo - Demo<BR>
Demo - Demo - Demo - Demo - Demo - Demo<BR>
</BODY>
</HTML>
[/CODE]

Error- newDiv is undefined help! - Asked By shuwen chew on 26-Apr-06 01:37 AM

thanks for the solution, but it has an error "newDiv is undefined"..was wondering how to solve it.. i'm on the line..help..
Check this: - Asked By J S on 26-Apr-06 02:30 AM
http://www.codeproject.com/useritems/PrintPreview.asp