I have pagination implemented on my View developed in C# MVC. Pagination is implemented with AJAX. The user can selects the records across the pages of the view and when they click the Print button, which is on the page, only those selected records will be printed.
In order to accomplish this I move the selected record into a <div id="ToPrintContainer" >
which in the Layout page.
On the click of the print button
I clone the
<div id="ToPrintContainer">
into my View.set the property of
.divPrintDetailed
asdisplay:none
.window.print()
Remove the
display:none
of.divPrintDetailed
Finally remove or empty the copied records.
<div id="ToPrintContainer" >
will contain only the records the user want to print.
<div class ="divPrintDetailed">
will conatin all the records.
The problem is on print i see a blank page.
if i comment $('.copiedDivForPrint').empty();
I see the selected records in the print window, which is what I want to happen, but the copied over records won't get cleared from the view.
Pasted below is the jQuery code.
$('#btnPrnt').unbind('click').bind("click", function () {
// copy the selected records into the view
$("#divTestPrintContainer").clone().addClass('copiedDivForPrint').insertAfter('.StatsCriteria');
// don't display the entire records on print
$('.divPrintDetailed').css({ 'display': 'none' });
window.print();
$('.divPrintDetailed').css({ 'display': '' });
$('.copiedDivForPrint').empty();
return false;
});