This sample project shows how to make a report detalization in a separate preview window. The report may contain the detailed data in the external report. For example, main and detail reports are shown in the separate preview window. Load the main report, add event listener for the click event, and show this report in the viewer:
private void button2_Click(object sender, System.EventArgs e)
{
StiReport report = new StiReport();
report.RegData(dataSet1);
report.Load("..\\LiveReports.mrt");
report.Compile();
report.CompiledReport.Click += new EventHandler(click);
report.Show();
}
In the
click
event you can load a detailed report with data filtering using the parameters from the main report:
private void click(object sender, EventArgs e)
{
var comp = sender as StiComponent;
var customerID = (string)comp.BookmarkValue;
if (customerID != null)
{
var report = new StiReport();
report.RegData(dataSet1);
report.Load("..\\Details.mrt");
var dataBand = (StiDataBand)report.Pages["Page1"].Components["DataBand1"];
var filter = new StiFilter("{Orders.CustomerID==\"" + customerID + "\"}");
dataBand.Filters.Add(filter);
report.Show();
}
}
In the screenshot below you can see the result of the sample code: