This is a migrated thread and some comments may be shown as answers.

instantiate a report

1 Answer 107 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 14 Jun 2013, 02:08 PM

I want to declare a telrik report and then start passing data to it for display.  In the following code it is seen that my activereports- which reside in another project) are seen.  but when i do similar code for telrik report it can not find the report and the telrik report resides in the same project that the activereports are.  What is the solution.  When I add Telrpt.Uri = "name of report"; at debug an error occurs stateing it can not find the uri. 

So this is two pronged 1. How can I do similar with telerik (Telerik.Reporting.Report = new TelRptContractTest(); as is done with activereport (DataDynamics.ActiveReports.ActiveReport rpt = new RptCustomerContract();)
2.  How can i pass data to telrik report in similar way as [((RptCustomerContract)rpt).MinContractYear = cheader.DeliveryBeginDate.Value.Year;]
The telrik reports have been added to the project and Telerik.Reporting is in the reference file of the application.

DataDynamics.ActiveReports.ActiveReport rpt = new RptCustomerContract();
DataDynamics.ActiveReports.ActiveReport rpt2 = new RptCustomerContractLocationDetail();
Telerik.Reporting.UriReportSource Telrpt = new Telerik.Reporting.UriReportSource();
((RptCustomerContract)rpt).MinContractYear = cheader.DeliveryBeginDate.Value.Year;

 

1 Answer, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 17 Jun 2013, 02:03 PM
Have you tried with InstanceReportSource:

Telerik.Reporting.InstanceReportSource instanceReportSource =
    new Telerik.Reporting.InstanceReportSource();
 
// Assigning the Report object to the InstanceReportSource
instanceReportSource.ReportDocument = new MyReports.Report1();
 
// Adding the initial parameter values
instanceReportSource.Parameters.Add(new Telerik.Reporting.Parameter("MinContractYear ", cheader.DeliveryBeginDate.Value.Year));
 
this.ReportViewer1.ReportSource = instanceReportSource;
Tags
General Discussions
Asked by
William
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Share this question
or