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">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="BBPViewer" runat="server" AutoDataBind="true" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</form>
</body>
</html>
C#
protected void Button1_Click(object sender, EventArgs e)
{
rpt.Dispose();
rpt.Close();
con = new SqlConnection("Data Source=DESKTOP-5PJ76B9;Integrated Security=SSPI;Initial Catalog=SilverProduction;MultipleActiveResultSets=True;");
try
{
con.Open();
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();
adp.Fill(ds);
for (int i=0; i<int.Parse(TextBox1.Text); i++)
{
var dialog = new PrintDialog();
rpt.Load(Server.MapPath("~/CRBigbalprnt.rpt"));
rpt.SetDataSource(ds.Tables["Table"]);
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) { }
}