Revision #4

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.

For printing the page, there is a Javascript function: window.print(). However, it will print the whole page. If you need to print only the content of Div, then you have a few options available, but the maximum is either using IFrame or the popup and then using window.print() to print the div content.

You can use JavaScript to open div content in a popup and then print it. See this solution here:

Another option is to use IFrame. See more about that here:

The recommended option is to use JQuery:
It uses the jquery.print.js plugin and works great.

This article was originally written by Jayant.

See Also

Revert to this revision