How to Print a Report made in Web Page

First of all insert the printable area into a Div.

then write below code in Page load

Suppose your Print button Id = btnPrint and
div id = printdiv

btnPrint.Attributes.Add("Onclick", "javascript:CallPrint('printdiv');");

pass this div id to the javascipt function written in HTML

function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1000,height=1000,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
}

Comments

Popular posts from this blog

How to change value on selection of dropdown list control in datagid

Dictionary used for key value pair

Insert value from one table into exsiting table in oracle i.e merge