Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir,

I am using this code "javascript:print();" in button clientclick event, kindly tell me the script that can print only particular page like the above code is printing the whole page.

I don't need the background of the page that it is printing.

Thank you in advance
Posted
Updated 13-Nov-11 23:33pm
v2
Comments
Uday P.Singh 14-Nov-11 5:42am    
Hey Prashant! How is Lucknow?
Prashant Srivastava LKO 3-Dec-11 0:33am    
Are u from Lucknow

Create a new css let print.css
include this css in your page with media = print

HTML
<link rel="stylesheet" type="text/css">
     href="print.css" media="print"></link>


In this css create class with your requirement and apply it
eg.this is css
CSS
.bc{background-color:red;}


print.css
CSS
.bc{background-color:white;}

now
HTML
<div class="bc">
...your code
</div>
 
Share this answer
 
 
Share this answer
 
When you use window.print (which is what you are doing, all it does is open a print dialog for the current page, allowing the user to select the page number and so forth to print. It won't allow you to separate the "good" from the "bad" and print only the items you want.

The simplest way is to create a separate, printer-friendly page, which you then print. There are other ways,. but they require a bit more thought and planning - Google can help you to find tutorials on that.
 
Share this answer
 
You can use PrintHelper class to print controls data
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900