Thursday, December 17, 2009

Print a Datalist partial from an ASP.NET Web Page

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


<div id="divPrint">
<asp:datagrid>
.....
.....
.....
</asp:datagrid>
</div>
<asp:button ID="btnPrint" onClick="javascript:CallPrint('divPrint');" Runat=Server />

No comments:

Post a Comment