I used the following code to print the HTML table in ASP.NET MVC:
function printdiv(printpage) {
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
This works perfectly and prints my html table as expected. But the problem is if my table have a lot of rows and more than one page it prints just one page and ignores the rest. How can I fix this issue?