Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.67/5 (6 votes)
See more:
sir please help me to print penal data in asp.net drag the table in penal
Posted
Comments
Sergey Alexandrovich Kryukov 11-May-12 17:41pm    
Well, I know such word as "penal", but not in English. What do you mean? :-)
--SA
R. Giskard Reventlov 11-May-12 18:40pm    
Have you even bothered to try and work something out for yourself? And by 'penal' do you mean jail or prison? Otherwise what is 'penal'?

1 solution

I believe you meant, How to print a panel (panel containing a table), here:
For Web applicaton, print code has to be on client side.

Either you can write your print related code in code behind and then inject it into the page:
How to Print in ASP.NET 2.0[^]

OR using JavaScript directly on the page itself, like:
JavaScript
function CallPrint()
{
  var printContent = document.getElementById(’<%= pnlToPrint.ClientID %>’);
  var printWindow = window.open("", "Print Panel", ‘left=50000,top=50000,width=0,height=0′);
  printWindow.document.write(prtContent.innerHTML);
  printWindow.document.close();
  printWindow.focus();
  printWindow.print();
  printWindow.close();
}

HTML
<asp: Panel runat="server" id="pnlToPrint" >
  <table>
    <tr>
      <td>
         Your data
      </td>
    </tr>
  </table>
</asp: Panel>

<input type="button" value="Print"  onclick="CallPrint();" />
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900