Skip to main content

XRSubreport.ReportSourceUrl Property

Gets or sets a URL or path that specifies a report’s location. The report content is included in the main report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v22.1.dll


public string ReportSourceUrl { get; set; }

Property Value

Type Default Description


A URL or path that specifies a report’s location.


Specify the URL or path to a REPX or XML file in the XRSubreport control’s ReportSourceUrl property to reference a report the content from which should be included in the main report in place of the XRSubreport.


The ReportSourceUrl property is not available in Visual Studio Report Designer.
In Web Report Designer, implement a report storage to allow users to specify the Report Source Url property.
Additionally, in ASP.NET Core web applications, use the Bind() method to specify the main report.

You can specify an absolute or relative path (starting with a “~”).

To reference an XtraReport class instance, use the XRSubreport‘s ReportSource property instead of ReportSourceUrl.

The ReportSourceUrl property value takes precedence over the ReportSource value. If you specify both properties, the XRSubreport includes the content from the report specified by ReportSourceUrl.

The layout of the report referenced in the ReportSourceUrl property is instantiated as an XtraReport object when the main report is rendered. The XtraReport object is assigned to the XRSubreport‘s ReportSource property. You can handle the XRSubreport.BeforePrint event to access the referenced report object through the ReportSource property.

See XRSubreport for more information.


The code sample below adds an XRSubreport item to the report and uses the ReportSourceUrl property to reference a detail report.


Online Example: Use Subreports to Add a Chart

using System.IO;
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
XRSubreport subreport = new XRSubreport() {
    BoundsF = new RectangleF(0, 100, 550, 25),
// "mainReport" is an XtraReport instance.
// Add subreport to the main report's DetailBand.
// 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");

The code sample below handles the XRSubreport.BeforePrint event to add an XRLabel control to the referenced report’s instance. This sample can be used with the code sample above.

using DevExpress.XtraReports.UI;
// ...
private void Subreport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    XRSubreport subreport = (XRSubreport)sender;
    XtraReport report = subreport.ReportSource;
    report.Bands["DetailBand"].Controls.Add(new XRLabel() {
        Text = " - ",
        BoundsF = new RectangleF(450, 0, 100, 25),
        Font = new Font(new FontFamily("Arial"), 9)
See Also