How to load the telerik report in reportviewer?

AHMAD SUMRAIZ picture AHMAD SUMRAIZ · Feb 12, 2014 · Viewed 7.7k times · Source

I am trying to load the telerik report on win form where i have a report viewer to show it ... But I am not successfull to load it. I am not getting its code working write. I want to make it on form load .

private void Form1_Load(object sender, EventArgs e)
{
      //Code here to load telerik 
}

Any way to load it like crystal report can load

{
    crystalReportViewer1.ReportSource = (@"C:\Users\CrystalReport1.rpt");
}

errors I am getting when I am do this

{
     Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
     typeReportSource.TypeName = "Telerik.Reporting.Examples.CSharp.ListBoundReport, CSharp.ReportLibrary";
     this.reportViewer1.ReportSource = typeReportSource;
     reportViewer1.RefreshReport();
}

enter image description here

Answer

FeliceM picture FeliceM · Feb 12, 2014

What I normally do is to deign the report inside VS in a class library. I then reference the class library in the application, ASP or Winforms. In your case, Winforms, once you have added your class library to the bin, select the "Report Source" from the report viewer properties and add the report from a path or selecting your class library. Thats it.

enter image description here

For more reference, have a look here.