Click here to Skip to main content
12,451,703 members (59,796 online)
Rate this:
Please Sign up or sign in to vote.
Dear Experts,

How to Print a Gridview.

I also need to print the Header logo (Complete Header) and also Gridview.

Please help . thank u.
Posted 14-Jan-13 23:07pm
RaviGupta7986 15-Jan-13 5:35am
you would have got answer faster if you would have entered this text in google in place of code project :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You want to print only Gridview not entire page.
Solution is, put Gridview inside a Panel as below:
<asp: Panel runat="server" id="pnlToPrint" >
 <asp:GridView ID="gvReport" runat="server"........>
</asp: Panel>
 <input type="button" value="Print"  onclick="CallPrint();" />
Now create a function as below:
function CallPrint()
  var printContent = document.getElementById('<%= pnlToPrint.ClientID %>');
  var printWindow ="", "Print Panel", 'left=50000,top=50000,width=0,height=0');

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 19 Nov 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100