Connecting to Data from Code
Our sample projects and report templates can help you learn the basics of working with our products.A report's data can be supplied and switched from Blazor code. This example loads a report and lets the user swap between two datasets.
Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
In the screenshot below you can see the result of the sample code:

Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
<StiBlazorViewer Report="@Report" />
@code {
private StiReport Report;
private void SetFirstDataSet()
{
var report = this.Report.Clone() as StiReport;
report.Dictionary.Databases.Clear();
report.RegData("Demo", firstDataSet);
report.Render();
this.Report = report;
}
}The report is cloned so each dataset produces an independent document; Dictionary.Databases.Clear() drops the design-time connection and RegData registers the new data. Reassigning this.Report updates the viewer.In the screenshot below you can see the result of the sample code:
