Hi Guys,
I'm trying to print invoice in Report Viewer, but the button print not showing even though already set "ShowPrintButton =true" in Report Viewer.
I have try many way to find the solution for get best print result, but using report viewer until now I'm not find the solution sir, and the I'm decided to use CrystalReportViewer to try solve my problem.
But I'm get problem CrystalReportViewer not show the result.
Any help could be appreciate.
public partial class Reporting_CetakBuktiSimpanan : System.Web.UI.Page
{
string koneksi = System.Configuration.ConfigurationManager.ConnectionStrings["db_koperasiConnectionString"].ConnectionString.ToString();
ReportDocument _ReportDocument = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
}
private void ShowDataToPrint()
{
using (SqlConnection con = new SqlConnection(koneksi))
{
using (SqlCommand cmd = new SqlCommand())
{
try
{
con.Open();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select * From View_Cetak_Bukti_Simpanan";
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adap.Fill(ds,"DataTable_Cetak_Bukti_Simpanan");
_ReportDocument.Load(Server.MapPath("~/RptReport/ReportCetakBuktiSimpanan.rpt"));
_ReportDocument.SetDataSource(ds);
CrystalReportViewer1.ReportSource =_ReportDocument;
CrystalReportViewer1.RefreshReport();
CrystalReportViewer1.DisplayToolbar = true;
con.Close();
}
catch (Exception ex)
{
throw ex;
}
}
}
}
protected void BtnPrintStrukBuktiSimpanan_Click(object sender, EventArgs e)
{
ShowDataToPrint();
}
}