ASP.NET - Print Only the Content Inside of Div

ASP.NET - Print Only the Content Inside of Div

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.


Community Resources

Leave a Comment
  • Please add 7 and 2 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
  • Ed Price MSFT edited Original. Comment: Cleaning this up.

Page 1 of 1 (1 items)
Wikis - Comment List
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Page 1 of 1 (3 items)