Use this code..
<script>
function myFunction() {
//window.print();
var panel = document.getElementById("<%=pnlContents.ClientID %>");//put your table inside a panel.
var printWindow = window.open('', '', 'height=800,width=800');
printWindow.document.write('<html><head><title>DIV Contents</title>');
printWindow.document.write('</head><body >');
printWindow.document.write(panel.innerHTML);
printWindow.document.write('</body></html>');
printWindow.document.close();
setTimeout
(function () {
printWindow.print();
}, 500);
return false;
}
</script>
Ref :
Print a doument with CSS