using DevExpress.DataAccess.Json; using DevExpress.XtraExport; using DevExpress.XtraReports.Services; using DevExpress.XtraReports.UI; using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Drawing.Printing; namespace TestDevExpress.Components.Reports { public partial class OfferReport : DevExpress.XtraReports.UI.XtraReport { public OfferReport() { InitializeComponent(); } public OfferReport(string baseUrl, int offerID) { InitializeComponent(); //Parameters["pImgPath"].Value = baseUrl; Parameters["pOfferId"].Value = offerID; _offerId = offerID; _basePath = baseUrl; RequestParameters = false; } private int _offerId = 0; private string _basePath = ""; protected override void OnDataSourceDemanded(EventArgs e) { var jsonDataSource = DataSource as JsonDataSource; if (jsonDataSource != null && !string.IsNullOrEmpty(_basePath) && _offerId > 0) { string url = $"{_basePath}/{_offerId}"; jsonDataSource.JsonSource = new UriJsonSource(new Uri(url)); jsonDataSource.ConnectionName = null; //RequestParameters = false; } } } }