Articles in this section
Category / Section

How to set and display No Data Message for data region items in ReportDesigner?

2 mins read

To specify custom text and show in a data region that has no data, set the NoRowsMessage property for a table, chart, and subreport report items. The following steps help you to create and preview the No Data Message report based on the dynamic value in WPF Report Designer.

  1. Create a new report, add embedded datasource and dataset. The following query adds the Department table from the AdventureWorks sample database.
    SELECT 
     [Department].[DepartmentID]
     ,[Department].[GroupName]
     ,[Department].[ModifiedDate]
     ,[Department].[Name]
     FROM 
     [HumanResources].[Department]
    WHERE
                  [HumanResources].[Department].[DepartmentID] = @DepartmentID
    

 

To set the NoRowsMessage for tablix, matrix, chart, or list

  1. Draw a table or chart report item and add the fields to the table from the report data explorer by expanding Dataset (Dataset1).

 

Add fields to the table from the report data explorer by expanding Dataset in WPF Report Designer

 

  1. In the Design area, click the table or chart on the design surface to select it. The properties pane displays with applied properties for the selected report item.

 

Property pane is rendered for selected report item in WPF Report Designer

 

  1. In the properties grid, type the custom text that you want to display as a message in the NoRowsMessage property field. You can also set the dynamic value to it based on the Expression through ‘Expression Editor’ dialog.

 

Set dynamic value through Expression in WPF Report Designer

 

  1. Here, query parameter DepartmentID is used to filter the data in runtime to showcase NoRowsMessage.

 

Query Parameter in WPF Report Designer

 

  1. You can customize the font and alignment properties of NoRowMessage with the help of property grid.

 

Customize the font and alignment properties in property grid in WPF Report Designer

 

To set the NoRowsMessage for a subreport

  1. Create a report parameter named ‘DepartmentID’ with text datatype in SubReport.

 

Created report parameter with text datatype in SubReport in WPF Report Designer

 

  1. In the main report design view, drag and drop the subreport. Click the Subreport property, select the Parameters option, and then click the Add button to specify the parameter detail. In Label textbox, specify the Parameter name created in Subreport. In Value textbox, specify the data field value to filter data in Subreport.

 

Specify the parameter name create in Subreport in label textbox in WPF Report Designer

 

  1. In the main report, click the subreport on the design surface to select it. The property pane displays the applied properties for the selected item.

 

Property pane rendered on selecting the subreport in WPF Report Designer

 

  1. In the properties grid, type the custom text that you want to display as a message in the NoRowsMessage property field. You can also set the dynamic value to it based on the Expression through ‘Expression Editor’ dialog.

 

Type the custom text or set it dynamically through expression that you want to display in WPF Report Designer

 

Preview the report

Preview the report to render the data region or subreport items in the ReportViewer based on the report parameter dynamic value as follows.

Preview the report in WPF Report Designer

Please download the report for no data message here

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied