Skip to content

Instantly share code, notes, and snippets.

@tucaz
Created October 27, 2011 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tucaz/1320202 to your computer and use it in GitHub Desktop.
Save tucaz/1320202 to your computer and use it in GitHub Desktop.
Kill me now please
function PrintContent() {
printWindow = window.open("", "mywindow", "location=0,status=0,scrollbars=1,resizable=1");
var strContent = "<html><head>";
strContent = strContent + "<title" + ">Print Preview</title>";
strContent = strContent + "<link href=\"Styles/jqGrid/ui.jqgrid.css\" type=\"text/css\" rel=\"Stylesheet\" />";
strContent = strContent + "<link href=\"Styles/JQueryUI/jquery-ui-1.8.16.custom.css\" type=\"text/css\" rel=\"Stylesheet\" />";
strContent = strContent + "<link href=\"Styles/ASI/Main.css\" type=\"text/css\" rel=\"Stylesheet\" />";
strContent = strContent + "<script type=\"text/javascript\" src=\"ClientScript/Shared/jquery-1.6.2.min.js\"></scr" + "ipt>";
strContent = strContent + "<script type=\"text/javascript\" src=\"ClientScript/Shared/jquery-ui-1.8.16.custom.min.js\"></scr" + "ipt>";
strContent = strContent + "<script type=\"text/javascript\" src=\"ClientScript/Shared/grid.locale-en.js\"></scr" + "ipt>";
strContent = strContent + "<script type=\"text/javascript\" src=\"ClientScript/Shared/jquery.jqGrid.min.js\"></scr" + "ipt>";
strContent = strContent + "<script type=\"text/javascript\" src=\"ClientScript/CreateRequest/CreateRequest.js\"></scr" + "ipt>";
strContent = strContent + "</head><body>";
strContent = strContent + "<div style='width:100%;text-align:right;'>";
strContent = strContent + "<input type='button' id='btnPrint' value='Print' style='width:100px' onclick='window.print()' />";
strContent = strContent + "<input type='button' id='btnCancel' value='Cancel' style='width:100px' onclick='window.close()' />";
strContent = strContent + "</div>";
// Writing summary
strContent = strContent + "<div style='width:100%; text-align:center;'>";
var divPrintSummary = document.createElement('div');
divPrintSummary.innerHTML = document.getElementById('divSummary').innerHTML;
for (var i = 0; i < divPrintSummary.childNodes.length; i++) {
if (divPrintSummary.childNodes[i].id == 'uclCreateRequestCustomerInformationUC')
divPrintSummary.childNodes[i].id = "";
}
strContent = strContent + divPrintSummary.innerHTML;
strContent = strContent + "</div>";
strContent = strContent + "<br / >"
strContent = strContent + "<div style='width:100%; text-align:center;'>";
var divGridSummary = document.createElement('div');
divGridSummary.innerHTML = document.getElementById('divGridSummary').innerHTML;
for (var i = 0; i < divGridSummary.childNodes.length; i++) {
if (divGridSummary.childNodes[i].id == 'GridsUC1')
divGridSummary.childNodes[i].id = "";
}
strContent = strContent + divGridSummary.innerHTML;
strContent = strContent + "</div>";
strContent = strContent + "<br / >"
strContent = strContent + "</body>";
printWindow.document.write(strContent);
printWindow.document.close();
printWindow.focus();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment