Monday, November 10, 2008

How to print a specified div only rather than a complete page..

Hi..

This time here is some java script stuff. the follwing function is used to print the specific div from the page..
now simply call this function whereEver you want as per the requirment.


function CallPrint()
{
{
var prtContent1 = document.getElementById("ctl00_ContentPlaceHolder1_PrintALL");
//var WinPrint = window.open('','','letf=1,top=1,width=100,height=100,toolbar=0,scrollbars=0,status=0');
var WinPrint = window.open('','');
WinPrint.document.write(prtContent1.innerHTML);
//WinPrint.document.close();
WinPrint.focus();
//WinPrint.print();
//WinPrint.close();
}
}

Have a Nice Day
sanjeev Kumar...

1 comment:

helpondesk said...

Thats a nice thing sanjeev earlier i faced the problem like this in which i have to print only the contentent of a Grid.Then i create grid on other page and integrate in my page with iframe........