Sir,
How to send detail directly on Printer in asp.net
I have a GridView namely abc.aspx OnClick LinkButton id=lnkVoucherPrint popup new page "VouchersPrintPV.aspx" perfectly. My requirement is, send page "VouchersPrintPV.aspx" (which is popping up) directly on printer and show printer dialog to select user required printer.
Instead of that user press ctrl+P to select printer
Please help
<asp:GridView ID="gvVoucher" runat="server">
<Columns>
<asp:TemplateField HeaderText="V. #" SortExpression="VoucherID">
<ItemTemplate>
<asp:LinkButton ID="lnkVoucherPrint" runat="server" Text='<%# Bind("VoucherId")%>'></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" Wrap="True" Width="50px" VerticalAlign="Bottom" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<script type="text/javascript">
function printPV(id)
{
window.open("VouchersPrintPV.aspx?id=" + id, "List", "scrollbars=yes,resizable=no,width=890,height=600");
return false;
}
</script>
Protected Sub gvVoucher_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles gvVoucher.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lnkPrint As LinkButton = e.Row.FindControl("lnkVoucherPrint")
If e.Row.DataItem("VoucherType").ToString = "PV" Then
lnkPrint.Attributes.Add("onclick", "javascript:return printPV('" & e.Row.DataItem("VoucherId") & "&sort=" & txtLastSortColumn.Text & "&cid=" &
Session("CompanyID") & "','Voucher' ,'location=1,status=1,scrollbars=1,width=900')")
End If
End If
End Sub