[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Report and Dashboard Server
  License and Distribution
 [Expand]Administrative Panel
 [Expand]Create Reports
 [Expand]Create Dashboards
 [Collapse]Configuration and API
   Report and Dashboard Server Authentication
   Manage Scheduled Jobs
   Specify Timeouts
   Switch to HTTPS Protocol
  User-Specific Functions
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)


This document describes the most common scenarios of using report scripts.

Expanded Disable Security in Scripts

By default, you are not permitted to access the file system and fill the data source using report scripts. It is not recommended that you change this default behavior.

If, for any reason, you need to disable the security restrictions (e.g., to enable logging), set the disableScriptSecurity flag to true in the Web.config file located at the directory where you installed the Report and Dashboard Server ("C:\Program Files (x86)\DevExpress\Report Server\Web\Worker" by default).

Expanded Script Editor

Each report element has its own set of events that can be handled by the Script Editor. To handle an event of a report element, do the following.

  1. Click the Scripts button () located on the Report Designer's toolbar.
  2. In the displayed Script Editor, specify a report control and one of events available for this cotnrol.

    After the event is chosen, a code template is generated in the current scripting language.

  3. To check for errors in the report's script, click the Validate button ().

    If an error is found, the string containing this error is marked with the icon. When a mouse pointer hovers over this icon, the text of the error is displayed.

Expanded Enable Logging

When the scripting security is disabled, you can use NLog for debug tracing by specifying the corresponding nlog configuration in the Web.config file of the worker service located at the directory where you installed the Report and Dashboard Server ("C:\Program Files (x86)\DevExpress\Report Server\Web\Worker" by default).

The following example illustrates how to use NLog in a script.

Expanded Access User Information

To access the information about a current user in report scripts, use the ReportContext functionality. The following code illustrates how to display the current user e-mail in a report.

The report context information is available only when a report is being viewed on a client. When a report is generated by the Scheduler, the ReportContext.Current property will return null.

Expanded Access Data Source Settings

The following code illustrates how to access a report's data source in scripts by handling the DataSourceDemanded event of the report.

The following code illustrates how to access and customize parameters of a stored procedure in scripts.

The following code illustrates how to access the settings of a multi-value data source parameter and select all available values in the ParametersRequestBeforeShow event handler.

Expanded See Also

Is this topic helpful?​​​​​​​