User Id :    Password :      New Member   Forgot Password  
 
Printing the content of div or panel
Description In general, we required to print the content of a portion of page. We don't need that whole page will get printed. So here I am going to provide a small java script function that can solve this problem.   No. of Views     2219
  Rating     5
Author Sumit Gupta   Posted On     05 Jul 2011
Tags ASP.NET    

Sample Code   Download Code

 

In general, we required to print the content of a portion of page. We don't need that whole page will get printed. So here I am going to provide a small java script function that can solve this problem.

Here is the code for print a specific area.

 

function PrintDiv() {    
var prtContent = document.getElementById('<%=divPrintArea.ClientID%>');   
var WinPrint = window.open('', '', 'left=0,top=0,width=900,height=600,toolbar=1,scrollbars=1,status=0');    
WinPrint.document.write(prtContent.innerHTML);    
WinPrint.document.close();   
WinPrint.focus();   
WinPrint.print();   
WinPrint.close();    
}

 

Enjoy................

About Author

About Author I am Sumit Gupta working in 3 Pillar Global Pvt. Ltd as Module Lead. I have 7+ year of experience in .Net technologies. I love to explore new technologies and write technical article. Sumit Gupta
No Photo
 
Country India
Company 3 Pillar Global Pvt. Ltd.
Home Page http://www.facebook.com/sumitgupta1225

Rate this article

Rating options from poor, fair, good, very good to excelent.  
 

Comments

 
 
Posted By Annonymous on 02 Sep 2011 at 12:40 PM
 
You're on top of the game. Thanks for shiarng.
 
 
   
Write your comment here.
Comment
Verification Code