Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:
CSS
<asp:Button ID="print" runat="server"  Text ="Print"
            onclick="print_Click"
            style="top: 6px; left: 758px; position: absolute; height: 26px; width: 62px" />
Posted
Updated 17-Jul-13 19:35pm
v2

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.
 
Share this answer
 
At this related question you have some links to look at for a solution
 
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