How to Drill Through Reports in a C# .NET Application
Tags: webdev, devops, csharp, tutorial
Published: 2023-08-23 15:21:30

---
canonical_url: https://developer.mescius.com/blogs/how-to-drill-through-reports-in-a-c-sharp-net-application
description: Learn how to drill through reports in a C# .NET application. See more from ActiveReports today.
---
This blog will show how to drill through from one report to another using [ActiveReports](https://developer.mescius.com/activereports). This tutorial discusses how to display a child report when a user clicks on text or an object in the main report.

This blog is accompanied by a video. Both the video and the blog will go through the same steps to achieve the same results. If you'd like to follow the video instead or use both together:

{% embed https://youtu.be/BuaUUjCU3Cs %}

We’ll continue using the report we generated in our [Getting Started - How to Create a .NET Report](https://developer.mescius.com/blogs/how-to-create-a-net-report-activereports).

As a reminder, this is an inventory report using a table grouped into product categories. It shows each product’s name, color, price, and size.

![Drill Through Reports in a C# .NET Application](https://files.grapecity.com/gc-website-media/ukml3ad1/01-drill.png?width=500&height=401.21212121212125)

We also have a second report showing a list of recent orders, including the customer’s name, the quantity they ordered, the price per quantity, any discount we’re giving them, and a total for that line item.

![Drill Through Reports in a C# .NET Application](https://files.grapecity.com/gc-website-media/h44dv44w/02-drill.png?width=500&height=332.1917808219178)

So, the goal here will be to drill through the first report, the Inventory Report, to see the Recent Orders report for a particular product category. If we click on the image of a product category in the Inventory Report, the Recent Orders report for that product category should display.

First, we’ll create some parameters to hold the ProductID and ProductName of the products we click on in our Inventory Report.

1\. Open the Recent Orders report in the ActiveReports Designer.

*   This time, we will use the ActiveReports Visual Studio Integrated Designer as our example. Still, you can also use the ActiveReports Desktop Designer or the ActiveReports Web Designer to do the same thing with similar steps.

2\. Right-click on parameters in the Report Explorer and choose Add Parameter.

3\. Set the Name to ProductID.

4\. Check the checkbox next to Hidden.

*   This will hide the parameter from users so they cannot interact with it directly but allows us to continue using it in the background.

5\. Click the green + button at the top of the parameters dialog to add another parameter.

6\. Name this one ProductName and change it to Hidden as well.

7\. Click OK.

Next, we’ll change the title in our Recent Orders report to include the ProductName stored in our parameter and filter the data in the report by the ProductID.

1\. Remove the existing “Recent Orders” text from the title checkbox

2\. Replace that old text with an expression:

*   =”Recent Orders for ““&[@ProductName]&””

3\. Right-click on the Orders data set and choose Edit

4\. In the Parameters tab of the DataSet dialog, add a new parameter

*   Set the Name to QueryParameter
*   Set the value to =Parameters!ProductID.Value

5\. Open the Query tab of the DataSet dialog

6\. At the end of the query, add the following:

*   where SalesLT.SalesOrderDetail.ProductID = @QueryParameter

7\. Click OK

Now, we can jump back into the Inventory Report, where we’ll add an Action event on the image to allow users to click on it to open the Recent Orders report for the pictured product.

1\. Open the Inventory Report in the ActiveReports Designer

2\. Select the image control embedded in the first cell of the table and open the property dialog box

3\. Open the Navigation tab in the Image dialog

4\. Select Jump to report and set the dropdown to our Recent_Orders report

5\. In the table below the dropdown, we’ll need to add two parameters: the parameters we’re passing into our Recent Orders report. The names of these parameters should match the ones in our Recent Orders report.

*   Name: ProductID, Value: =Fields!ProductID.Value, Omit: false
*   Name: ProductName, Value: =Fields!Name.Value, Omit: false

![Drill Through](https://files.grapecity.com/gc-website-media/dzudv15y/03-drill.png?width=500&height=218.9679218967922)

And that’s it! Everything should be working the way we planned now. If you click on a product image in the Inventory Report, it should drill through to the Recent Orders for that product.

![Final Drill Through](https://files.grapecity.com/gc-website-media/sxrlnbuv/04-drill.gif?width=455.5680539932509&height=500)