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

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.