Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Access the Report Parameters Object in Report Scripts

This topic describes how you can access data of the report parameters object (inherited from ReportParametersObjectBase and specified using IReportDataV2.ParametersObjectType) in report scripts.

Use the following code to access the Parameters Object from a script.

object xafParameters = 
    ((DevExpress.XtraReports.UI.XtraReport)sender).Parameters["XafReportParametersObject"].Value

For instance, the following script displays the name of the Position selected in the parameters dialog as a label text.

private void ContactsBaseReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    label1.Text ="";
    DevExpress.XtraReports.Parameters.Parameter param = 
        (DevExpress.XtraReports.Parameters.Parameter)((DevExpress.XtraReports.UI.XtraReport)sender).
            Parameters["XafReportParametersObject"];
    if(param != null) {
        MySolution.DemoParameters xafParameter = 
            (MySolution.DemoParameters)param.Value;
        label1.Text = xafParameter.ContactPosition.Name;
    }
}
See Also