如何打开打印对话框?显示错误为“未安装打印机".在服务器端单击报表中的“打印"按钮时 [英] how to open print dialog ?Showing error as"no printer installed" on clicking print button in report at server side

查看:96
本文介绍了如何打开打印对话框?显示错误为“未安装打印机".在服务器端单击报表中的“打印"按钮时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在服务器端单击报告中的打印"按钮时显示错误为未安装打印机",但是当我在本地系统中运行时,页面没有问题...如何在服务器端解决该问题?

以下是我后面的代码中的代码:


受保护的void print_Click(对象发送者,EventArgs e)
{
试试
{
oReport1.Load(Server.MapPath(〜/Report/PaySalaryMonthWise.rpt"));


connection.DoCRLogin(oReport1);

CrystalReportViewer1.ReportSource = oReport1;
CrystalReportViewer1.DataBind();


oReport1.PrintToPrinter(1,false,0,0);



}
设计编号:

showing error as"no printer installed" on clicking print button in report at server side but when i run in my local system no problem the pages are getting printed...how to solve it in server side?

following is my code in my code behind:


protected void print_Click(object sender, EventArgs e)
{
try
{
oReport1.Load(Server.MapPath("~/Report/PaySalaryMonthWise.rpt"));


connection.DoCRLogin(oReport1);

CrystalReportViewer1.ReportSource = oReport1;
CrystalReportViewer1.DataBind();


oReport1.PrintToPrinter(1, false, 0, 0);



}
design code:

<asp:Button ID="print" runat="server"  Text ="Print"
            onclick="print_Click"
            style="top: 6px; left: 758px; position: absolute; height: 26px; width: 62px" />

推荐答案

首先:您必须了解该软件的哪一部分运行.
即使在本地开发计算机上进行测试,也要考虑两个不同的部分,即使它们在同一台物理计算机上也是如此.当您的网络应用托管在网络中的某个位置时,一部分(即服务器部分)位于托管服务器上.
当您执行asp.net代码时,这会在服务器上发生. IE.在互联网上的服务器上,而不是在本地计算机上!不,不在您的本地计算机上.
它在客户端计算机上用于打印报告的位置.因此,这是要在客户端上执行的操作,您可以在Web浏览器中看到应用程序的位置上进行打印. JavaScript在浏览器中运行.因此,请使用一些JavaScript来启动打印.
First of all: you have to understand where which part of the software runs.
Even when you test on your local development machine, there are two different parts to consider, even though they are on one physical machine. When your web application gets hosted somewhere in the web, one part - i.e. the server part - is on the hosting server.
When you execute asp.net code, that happens on the server. I.e. on the server in the internet, not on your local machine! No, not on your local machine.
It is on the client machine where to print the report. Consequently, that''s something to be executed there on the client where you see the application in a web browser where to do the printing. JavaScript runs in the browser. Consequently, use some JavaScript to initiate printing.


At this related question you have some links to look at for a solution


这篇关于如何打开打印对话框?显示错误为“未安装打印机".在服务器端单击报表中的“打印"按钮时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆