How to create an unrelated subreport in another unrelated report

I have an unrelated XtraReport that has a subreport control that contains another report. I call it “unbound” in a report that has a field definition using a schema but is not tied to any DataSet, I create a DataTable using the data access level, and then pass that object to the DataSource property of the report.

So, I have the following code:

        // (...) Get the data from the db and fill a DataTable

        if (table.Rows.Count > 0)
        {
            report.DataSource = table;

            // (...) Get the data from the db and fill a DataTable for the subreport
            report.SubPurchaseOrder.Report.DataSource = tableSubReport;

            report.ShowPreviewDialog();
        }
        else
        {
            MessageBox.Show("No data to show.");
        }

But what I get when using this approach is a very detailed report, presented below (see attached pdf , sorry in Spanish, but I think you understand this idea).

DevExpress, , , , , , , , , , ?

, , .

EDIT:

.

- . BeforePrint subreport :

((XRSubreport)sender).ReportSource.FilterString = "[IdPO_RO] = " + _idPurchaseOrder;

((XRSubreport)sender).ReportSource.Parameters["Id"].Value = _idPurchaseOrder;

, , , .

+3
1

.

, . :

report.SubPurchaseOrder.Report.DataSource = tableSubReport;

:

report.SubPurchaseOrder.ReportSource.DataSource = tableSubReport;

, , , , subreport (XRSubreport).

+3

Source: https://habr.com/ru/post/1718760/


All Articles