[Solved] Crystal Report print multiple copies not working in ASP.Net

Last Reply 4 months ago By dharmendr

Posted 4 months ago

i tried to print label multiple time, this code is working on source level means before publishing, after publishing this code it does not work

asp.net is server side working, but i want to print from client side.

please reconsider this issue here is my code.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BigBalePrintView.aspx.cs" Inherits="Saleorder.BigBalePrintView" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <form id="form1" runat="server"> 
        <CR:CrystalReportViewer ID="BBPViewer" runat="server" AutoDataBind="true" />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />


        protected void Button1_Click(object sender, EventArgs e)
            con = new SqlConnection("Data Source=DESKTOP-5PJ76B9;Integrated Security=SSPI;Initial Catalog=SilverProduction;MultipleActiveResultSets=True;");
                SqlCommand cmd = new SqlCommand("spbigbaleprint", con);
                cmd.CommandType = CommandType.StoredProcedure;
                 // cmd.Parameters.AddWithValue("@BID", Request.QueryString["BID"]);
                 cmd.Parameters.AddWithValue("@BID", TextBox2.Text);
                 SqlDataAdapter adp = new SqlDataAdapter(cmd);
              DataSet ds = new DataSet();
              for  (int i=0;  i<int.Parse(TextBox1.Text); i++)
                  var dialog = new PrintDialog(); 

                  PrintDocument pd = new PrintDocument();
                  rpt.PrintOptions.PrinterName = pd.PrinterSettings.PrinterName;
                  rpt.PrintToPrinter(1, false, 0, 0);

                  rpt.PrintOptions.PrinterName = "TSC TTP-244 Pro";
                   // rpt.PrintToPrinter(1, true, 0, 0);
                   // BBPViewer.ReportSource = rpt;
                   //rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "Bigbalprd");

            catch (Exception ex) { }