How do i print asp page on client side ?
the code
<input type="button" value="Print" onClick="window.print()">
prints the entire asp page .if i want to print only the contents of the page and not the links and other stuff .How do i do it ?
Can I get a sample code for it .

Thank you

12 Years
Discussion Span
Last Post by william_stam

Wel they way I use to print the whole page is by using the javascript to hide the things i dont want to appear on the print.
I use this javascript to hide the things, I pass the id of that particular HTML element whom i want to hide like the table, images etc...
Then you can call the print method to print the page.

function showhide(id)
  var itm = null;
  if (document.getElementById) {
   itm = document.getElementById(id);
  } else if (document.all){
   itm = document.all[id];
  } else if (document.layers){
   itm = document.layers[id];
  if (itm.style) {
   if (itm.style.display == "none") { itm.style.display = ""; }
   else { itm.style.display = "none"; }

therwise just use the meta print thiny. it prints an entirely different page to the one showed. so set up 2 asp pages. 1 to be viewed, 1 to be printed

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.