|
C#•Create a Button Event Handler Listing 1. Use JavaScript to handle the mechanics of popping up a new browser window containing the printable content of a Web page. private void btnPrintableVersion_Click(object sender,
System.EventArgs e)
{
String strRedirectScript;
// Generate JavaScript to pop up a print-only window
strRedirectScript =
"<script language =javascript>";
strRedirectScript +=
"window.open('OrderPrintableVersion.aspx',null,
'toolbar=0,scrollbars=1,location=0,statusbar=0,
menubar=1,resizable=1,width=600,height=400,
left=5 0,top=50');";
strRedirectScript += "</script> ";
// Save off OrderID for print page to use
Session.Add("OrderID",
lstOrderID.SelectedItem.ToString());
Response.Write(strRedirectScript);
}
|