Original

You are currently reviewing an older revision of this page.
Go to current version
Requirement: Print only the content inside of Div in asp.net
Solution:
For printing the Page there is a Javascript function window.print(). but it will print whole page. If you need to print only content of Div then there are few options  avilable in Internet. but maximum is either using IFrame or Window.open() popup and then use window.print() to print the div content.

Using JavaScript open div content in popup and then print. I found this solution
http://geekiest.net/post/Print-the-content-of-a-div-using-JavaScript.aspx
another one is use of IFrame
http://www.isolutionteam.co.uk/printing-contents-of-a-div-using-javascript/

The better option is use of JQuery.
http://www.bennadel.com/index.cfm?event=blog.viewcode&id=1591&index=1
it uses jquery.print.js plugin and it woks great


Jayant



Revert to this revision