G
Guest
Hello Everyone,
I am trying to print a gridview. I have a print button on my aspx page.
Below is the javascript code
function CallPrint( strid )
{
var prtContent = document.getElementById( strid );
var WinPrint = window.open('', '',
'left=0,top=0,width=1050,height=600,toolbar=1,scrollbars=1,status=0');
WinPrint.document.write( prtContent.innerHTML );
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
// prtContent.innerHTML=strOldOne;
}
<asp:Button ID="btnPrint" runat="server" Text="Print the Grid"
OnClick="btnPrint_Click" Style="position: static" />
Inside the aspx.cs page, i have
btnPrint.Attributes["onclick"] = "javascript:CallPrint('print_Grid');";
and my gridview is inside the <div> tag
<div id="print_Grid">
gridview - that needed to be printed
</div>
I have two questions:
1) I can print the grid view but not all the columns are coming in the
printout. Last 10 columns of the aspx screen are cutoff from the printout. Is
it possible to printout and see all the columns. I tried landscpae view, but
still all the columns are not coming in the print out.
2) can I get the header of the gridview in every printout.
Please let me know if it possible
Thanks.
I am trying to print a gridview. I have a print button on my aspx page.
Below is the javascript code
function CallPrint( strid )
{
var prtContent = document.getElementById( strid );
var WinPrint = window.open('', '',
'left=0,top=0,width=1050,height=600,toolbar=1,scrollbars=1,status=0');
WinPrint.document.write( prtContent.innerHTML );
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
// prtContent.innerHTML=strOldOne;
}
<asp:Button ID="btnPrint" runat="server" Text="Print the Grid"
OnClick="btnPrint_Click" Style="position: static" />
Inside the aspx.cs page, i have
btnPrint.Attributes["onclick"] = "javascript:CallPrint('print_Grid');";
and my gridview is inside the <div> tag
<div id="print_Grid">
gridview - that needed to be printed
</div>
I have two questions:
1) I can print the grid view but not all the columns are coming in the
printout. Last 10 columns of the aspx screen are cutoff from the printout. Is
it possible to printout and see all the columns. I tried landscpae view, but
still all the columns are not coming in the print out.
2) can I get the header of the gridview in every printout.
Please let me know if it possible
Thanks.