Search code examples
c#devexpressxtrareport

AspxDocumentViewer XtraReport and empty data


I'm using XtraReport and AspxDocumentViewer. I wrote those codes to show. But I'm always taking some problem; empty data.

How to fix this? I can't see what's wrong.

By the way "dsMast", it's dataset and there are ten rows. But still the report is empty.

string fpth = Server.MapPath(".");
fpth = fpth + "\\report\\rprFtrLst22222.repx";
XtraReport report = XtraReport.FromFile(fpth, true);
report.DataSource = dsMast;
report.LoadLayout(fpth);
report.CreateDocument();
string reportName = (string)"report";
ASPxDocumentViewer1.Report = report;
ASPxDocumentViewer1.DataBind();
Session["ReportName"] = reportName;

enter image description here


Solution

  • I fixed my problem. First of all, I added some code for page_load

            if (Session["report2"] != null)
            {
                ASPxDocumentViewer1.Report = Session["report2"] as XtraReport;
            }
    

    And then I used thoso codes.

            report.DataSource = dsMast;
            report.LoadLayout(fpth);
            report.CreateDocument();
            ASPxDocumentViewer1.Report = report;
            ASPxDocumentViewer1.DataBind();
            Session["report2"] = report;