views:

143

answers:

0

hi, I have a HTML button,upon clicking the button I am calling the following javascript function,passing the div id in which my gridview is present.

function CallPrint(strid)

{  
var prtContent = document.getElementById(strid);

var WinPrint = window.open('', '', 'left=0,top=0,width=900,height=600,toolbar=1,scrollbars=1,status=0');

WinPrint.document.write( prtContent.innerHTML );

WinPrint.document.close();

WinPrint.focus();

WinPrint.print();

WinPrint.close();  


}  

B'coz my gridview has around 3000 records I am paginating the results.So when I use the above code to print,I can see only the records from the 1st page getting printed.so in order to print all the records I thought of placing 2 gridviews(one with Allowpaging='true' and the other one with 'false') on the page and I am binding the same datasource to both of them.The gridview with Allowpaging='false' is set to 'display:none' on page load and in the above CallPrint() method I wanted to set the display of this gridview to 'block' and the other one to 'none'.But it doesnt seem to work fine as the user will see all the records in the browser as well not only in the printed doc.

I've also thought of using a session to store my gridview and print it in another page as mentioned here.As my data is huge(around 3000 records) I am confused if this would affect the performance...

Could someone please suggest how can I print all the data?

Thanks.