Print a div using javascript

Posted by Bhanubysani under ASP.NET on 12/3/2012 | Points: 10 | Views : 1515 | Status : [Member] | Replies : 1
Hi,

I have a div contains HTML table,image and grid view.i am using JavaScript to print the div.my script is like below

function PrintPanel() {

var displaySetting = "left=0,top=0,width=1050,height=600,toolbar=1,scrollbars=1,status=0";
var contentGridView = document.getElementById('<%= ContentDiv.ClientID %>');
var WinPrint = window.open('', '_blank', '', displaySetting);
WinPrint.document.write("<div style='width:100%;'>"); //
WinPrint.document.write("<table width='100%'><tr><td>"); //
WinPrint.document.write(contentGridView.innerHTML);
WinPrint.document.write("</td></tr>"); //
WinPrint.document.write("<table>"); //
WinPrint.document.write("</div>"); //
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();



}

When i am printing the div half of the page is coming empty and after that image and table is coming almost 30 records are missing in that grid.
why i dint understand but when i tried with only the grid view its working good.Please help me to solve the issue.

Regards,
Bhanu Prakash Bysani



Responses

Posted by: Pavanandey on: 12/6/2012 [Member] Bronze | Points: 25

Up
0
Down
try increasing the height of the display settings

Thanks
Pavan Kumar
Mark Answer if this fits the need

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response