I am trying to print the gridview using javascript. Gridview looks really nice on the web page, but when I try to print out the gridview, it gets squished. I can even see the outline of squished gridview. Below is the image of the gridview in the print out:
as you can see the outline of the gridview after $14.00. the lighter outline after $14.00 is the entire gridview, but in printout, it got squished. Below is the code for the printout:
<script>
function printContent(el) {
var restorepage = $('body').html();
document.getElementById('<%=lblDateTime.ClientID %>').style.display = "block";
document.getElementById('<%=lblDateTime.ClientID %>').innerHTML = 'Current Date Time: ' + new Date().toLocaleString();
document.getElementById('<%=acrLogo.ClientID %>').style.display = "block";
document.getElementById('<%=compName.ClientID %>').style.display = "block";
var printcontent = $('#' + el).clone();
printcontent.removeAttr('style');
$('body').empty().attr('style', 'background-color: white;').html(printcontent);
$('body').empty().html(printcontent);
window.print();
$('body').html(restorepage);
}
</script>
How can I expand the gridview all the way to the line so that it doesn't get squished in the print out. below is the code of the gridview:
<div class="container">
<div class="row justify-content-center">
<div class="col-sm-6">
<asp:GridView ID="grdCalculate" runat="server" GridLines="Horizontal" CssClass="table table-responsive table-hover table-striped table-bordered table-condensed" OnRowDataBound="grdCalculate_RowDataBound">
</asp:GridView>
</div>
</div>
</div>
any help will be aprpeciated.