6 Answers, 1 is accepted
Our suggestion is to instantiate your report and set the datasource property within the WPF Form's constructor as shown in the following code snippet:
public Window1()
{
InitializeComponent();
var report1 = new MyReport();
report1.DataSource = myDataSet;
ReportViewer1.Report = report1;
}
Peter
the Telerik team
<telerik:ReportViewer Grid.Row="0" x:Name="ReportViewer1" Report="{Binding DataContext.AuditReport, Mode=TwoWay}" />
To use binding you should create the View Model first and set it as DataContext for the ReportViewer (or the Form).
Best wishes,
Hrisi
the Telerik team
HI,
i was reading this post and i have a question because i can find the way to inser a dataset with the data that i wan to show in the report because of this.
i've pass the uri of the report to the datasource but, where i can put my dataset?
<body>
<script runat="server">
public override void VerifyRenderingInServerForm(Control control)
{
// to avoid the server form (<form runat="server"> requirement
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
var Datasett = loaddata();
var report = new Telerik.Reporting.TypeReportSource() { TypeName = "Ruta.Reporte, Ruta" };
MyReportViewer.ReportSource = report;
}
</script>
<form id="main" method="post" action="">
<telerik:ReportViewer ID="MyReportViewer" runat="server" Height="1100px" Width="100%" DocumentMapVisible="False" ParametersAreaVisible="False" ShowDocumentMapButton="False" ShowHistoryButtons="False" ShowNavigationGroup="True" ShowParametersButton="False" ShowPrintPreviewButton="False" ShowRefreshButton="False" Skin="WebBlue" Visible="True" ></telerik:ReportViewer>
</form>
Hello Rosbel,
My understanding is that you would like to assign a DataSet as DataSource for a report in the code. For this purpose, you have to instantiate the report, modify its DataSource and then pass it to the Reporting engine wrapped in an InstanceReportSource.
From the settings of the ReportViewer, I assume that you use the Html5 Web Forms Report Viewer. It requires a Telerik Reporting REST Service, where the reports are rendered. To achieve the requirement you will need to create a Custom Report Resolver. Both the report and the data should be accessible by the resolver. You may check How to display a report via InstanceReportSource in the HTML5 Viewer KB article for details.
Regards,
Todor
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.