Skip to main content
.NET 6.0+

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