I'm trying to show my crystal report into my website. I can print this report but I don't understand why when I want to show data in crystal report viewer why it's not showing. I research in the website, then use CrystalReportViewer1.Refresh()
but I can not use it, it says
Error 1 'CrystalDecisions.Web.CrystalReportViewer' does not contain a definition for 'Refresh' and no extension method 'Refresh' accepting a first argument of type 'CrystalDecisions.Web.CrystalReportViewer' could be found (are you missing a using directive or an assembly reference?) D:\\GenerateQR\\GenerateQR\\default.aspx.cs 115 38 GenerateQR
This is my code
if (dtQR.Rows.Count > 0) {
string dirprint = @"D:\GenerateQR\GenerateQR\Report\Qreport.rpt";
//CR = new ReportDocument();
//CR.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;
//CR.Load(dirprint);
////CR.PrintOptions.PrinterName = @"\\10.4.201.89\SCX-5635";
//CR.SetDataSource(dtQR);
//CrystalReportViewer1.ReportSource = CR;
//CR.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"D:\ASD.pdf");
////CR.PrintToPrinter(1, false, 0, 0);
CR = new ReportDocument();
CR.Load(dirprint);
CR.SetDataSource(dtQR);
CrystalReportViewer1.ReportSource = CR;
CrystalReportViewer1.Refresh();
}
This is my code in aspx
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
</div>
</form>
I looks like it should be
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.ReportSource = rpt
not Refresh().
if (dtQR.Rows.Count > 0) {
string dirprint = @"D:\GenerateQR\GenerateQR\Report\Qreport.rpt";
CR = new ReportDocument();
CR.Load(dirprint);
CR.SetDataSource(dtQR);
CR.Refresh();
CrystalReportViewer1.ReportSource = CR;
Maybe you can try this way?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.