Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Use:
C#
protected void butSubmit_Click(object sender, EventArgs e)
 {
  ClientScript.RegisterStartupScript(this.GetType(), "popup", "<script>CallPrint(divPrint);</script>",true);
}

to call javascript print function
XML
function CallPrint(strid)
{

var headstr = "<html><head><title>Print Page</title></head><body>";
var footstr = "</body></html>";

var WinPrint = window.open('','','left=150,top=150,width=300,height=300,menubar=1,toolbar=0,scrollbars=0,status=0');

WinPrint.document.write(headstr + strid.innerHTML + footstr);

WinPrint.document.close();

WinPrint.focus();
WinPrint.print();

}

but the problem is it not working properly. when i use alert after window.open in javascript it working but alert not working after WinPrint.document.write.

How to solve this problem? I want to print the contents inside div tag.
Posted
Updated 28-May-12 2:25am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900