-
Notifications
You must be signed in to change notification settings - Fork 204
Drill through Reports
A drill-through action lets a user click a value in one report to open a second, more detailed report filtered to that value. For example, clicking a customer name in a summary report opens a detail report showing only that customer's orders.
- Open the parent (summary) report in the designer.
- Select the Textbox or field that should be clickable.
- Right-click → Properties → Action tab.
- Set Action type to Drill-through report.
- In the Report field, enter the path to the child
.rdlfile (relative to the parent report's folder). - Under Parameters, map parent field values to child report parameters:
- Parameter name — the parameter name as defined in the child report
-
Value — an expression from the parent dataset, e.g.
={CustomerId}
The child report must define a Report Parameter matching the name you mapped in step 6. The parameter filters the child report's dataset query:
-- Child report dataset SQL
SELECT OrderId, Amount, OrderDate
FROM Orders
WHERE CustomerId = @CustomerIdThe WinForms viewer raises the HyperlinkAction event when any action link is clicked, including drill-through. Wire up the event to load the child report in a new window or panel:
rdlView.HyperlinkAction += async (sender, e) =>
{
if (e.Hyperlink.StartsWith("report://", StringComparison.OrdinalIgnoreCase))
{
// Parse the drill-through URL to extract report path and parameters
var uri = new Uri(e.Hyperlink);
var childPath = uri.LocalPath;
var query = System.Web.HttpUtility.ParseQueryString(uri.Query);
var childViewer = new RdlViewerForm(childPath, query);
childViewer.Show();
e.Handled = true;
}
};See Hyperlink Custom Action for the full event API.
ReportViewer.HyperlinkClicked += async (sender, e) =>
{
// Open child report in a new Avalonia window
var childWindow = new ReportWindow(e.Hyperlink);
await childWindow.ShowDialog(this);
};Drill-through is an interactive feature for viewers. In PDF, Excel, and TIFF output the links are rendered as static hyperlinks pointing to the raw action URL. In HTML output the links are rendered as <a href> elements.
For ASP.NET Core, intercept the link URL server-side and render the child report on demand, returning it as a new HTTP response.
| Drill-through | Sub-report | |
|---|---|---|
| Triggered by | User click at run time | Always rendered inline |
| Child report visible | Only when user navigates | Embedded in parent output |
| PDF output | Link in PDF (navigates if PDF viewer supports it) | Rendered inline in the same PDF |
| Use case | Interactive exploration, detail-on-demand | Fixed composite reports |
Use sub-reports when the child content must always appear in the output. Use drill-through when the detail is optional and driven by user interaction.
Map as many parameters as needed in the Action dialog. Common patterns:
- Pass a surrogate key (
CustomerId,OrderId) — the child filters by ID. - Pass a date range — the child shows data for the clicked period.
- Pass the parent's connection string override — the child queries the same dynamic database.