Joseph Eldho

Joseph Eldho

  • NA
  • 187
  • 10.3k

Print Row data in Gridview Asp.net C#

Aug 11 2017 1:19 AM
//head
<script type="text/javascript">
function RPrint()
{
var prtContent = document.getElementById('<%= PORPT.ClientID %>');
prtContent.border = 0; //set no border here
var WinPrint = window.open('','','left=100,top=100,width=1000,height=1000,toolbar=0,scrollbars=1,status=0,resizable=1');
WinPrint.document.write(prtContent.outerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
//in body (gridview id = PORPT)
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<a href="javascript:;" onclick="RPrint(this)">
<asp:Button ID="ButPrint" runat="server" Text="Print" BackColor="#009900" ForeColor="White"
Height="26px" Width="52px" /></a>
</ItemTemplate>
</asp:TemplateField>
 

Attachment: grid.rar

Answers (2)