TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Akhter HUssain
724
1.3k
101.7k
Label print using crystal report in asp.net c#?
Aug 7 2019 1:29 PM
i want to print one report multiple times on user input number of page to be print, as like in this video....here is link of that video Https://www.youtube.com/watch?v=i7NYevleSA0 .
current;y i am printing one report on one page using crystal report ,,,,
here is my code
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Configuration;
using
System.Data;
using
System.Data.SqlClient;
using
System.IO;
using
System.Globalization;
using
Microsoft;
using
Salesorder;
using
CrystalDecisions.CrystalReports.Engine;
using
System.Drawing.Printing;
namespace
Salesorder
{
public
partial
class
Print : System.Web.UI.Page
{
SqlConnection con =
new
SqlConnection();
ReportDocument rpt =
new
ReportDocument();
protected
void
Page_Load(
object
sender, EventArgs e)
{
//if (!IsPostBack)
{
rpt.Dispose();
rpt.Close();
// loadReport();
}
}
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;
ReportDocument rd =
new
ReportDocument();
// rd.PrintToPrinter(Convert.ToInt32(TextBox1.Text.Trim()), false, 0, 0);
CrystalReportViewer1.ReportSource = rpt;
rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response,
false
,
"Bigbalprd"
);
}
catch
(Exception ex) { }
}
protected
void
CRBigview_Unload(
object
sender, EventArgs e)
{
if
(rpt !=
null
)
{
rpt.Close();
rpt.Dispose();
}
}
}
}
Reply
Answers (
4
)
How to insert Master Table ID into Child Detail table ?
PHP To ASP.NET mvc (C#)