Skip to main content
All docs
V25.1
  • SubreportBase.ParameterBindings Property

    Allows you to access to a collection of subreport parameter bindings. Use the property to bind the subreport report parameters to the master report’s fields or parameters.

    Namespace: DevExpress.XtraReports.UI

    Assembly: DevExpress.XtraReports.v25.1.dll

    NuGet Package: DevExpress.Reporting.Core

    Declaration

    [SRCategory(ReportStringId.CatData)]
    public ParameterBindingCollection ParameterBindings { get; }

    Property Value

    Type Description
    ParameterBindingCollection

    A collection of parameter bindings for the subreport.

    Remarks

    Use parameter bindings to pass parameter values from the main report into the referenced report. You can bind parameters used as filter criteria in the referenced report to data fields, calculated fields, or parameters from the main report.

    Tip

    Review the following help topic for information about parameter bindings in a master-detail report: Create a Master-Detail Report with a Subreport in the VS Report Designer.

    You can manipulate the ParameterBindingCollection instance stored in the ParameterBindings property or use the following methods:

    • FillParameterBindings() - populates the ParameterBindings collection with the referenced report’s parameters that are not listed in this collection.
    • ApplyParameterBindings() - sets the referenced report’s parameter values to the current values of fields or parameters that they are bound to.
    • RemoveUnusedParameterBindings() - removes inappropriate subreport parameter bindings from the ParameterBindings collection.

    Example

    The code sample below adds an XRSubreport item to the report and uses the ReportSourceUrl property to reference a detail report. The sample also binds the referenced report’s parameter to the main report’s data field.

    View Example: Use Subreports to Add a Chart

    using System.IO;
    using System.Drawing;
    using DevExpress.XtraReports.UI;
    using DevExpress.XtraReports.Parameters;
    // ...
    XRSubreport subreport = new XRSubreport() {
        BoundsF = new RectangleF(0, 100, 550, 25),
    };
    // "mainReport" is an XtraReport instance.
    // Add subreport to the main report's DetailBand.
    mainReport.Bands["DetailBand"].Controls.Add(subreport);
    // Reference a report from the report definition (REPX) file. The file is stored in the application's folder.
    subreport.ReportSourceUrl = Path.Combine(Path.GetDirectoryName(typeof(ReportCreator).Assembly.Location), "DetailReport.repx");
    // Bind the detail report's "prmCategory" parameter to the main report's "Categories.CategoryID" data field.
    subreport.ParameterBindings.Add(new ParameterBinding("prmCategory", null, "Categories.CategoryID"));
    
    See Also