Telerik HTML5 Pass-through Reports

I tried the MVC helper and the standard HTML5 viewer. I'm curious if anyone can successfully upload a report containing the parameters with the help of new viewers. I can not get any feedback from Telerik.

@{ var report = new UriReportSource() { Uri = "TestReport.trdx" }; report.Parameters.Add(new Telerik.Reporting.Parameter() { Name="UserId", Value=1234 }); report.Parameters.Add(new Telerik.Reporting.Parameter() { Name = "UserName", Value = "Test User" }); } @(Html.TelerikReporting().ReportViewer() .Id("reportViewer1") .ServiceUrl("/api/reports/") .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html") .ReportSource(report) .ViewMode(ViewModes.INTERACTIVE) .ScaleMode(ScaleModes.SPECIFIC) .Scale(1.0) .PersistSession(false) ) 
+7
telerik telerik-reporting
source share
4 answers

It's amazing if you have already tested How To: pass values ​​for report parameters in Telerik documents or not.

0
source share

You need to declare the report data source separately, and then pass it, for example,

 @{ var dataSource = new UriReportSource() { Uri = "rptUncashedCheckLetter.trdx" }; dataSource.Parameters.Add(new Telerik.Reporting.Parameter() { Name = "CheckNumber", Value = "2315527" }); } @(Html.TelerikReporting().ReportViewer() .Id("reportViewer1") .ServiceUrl("/api/reports/") .TemplateUrl("/Reports/telerikReportViewerTemplate.html") .ReportSource(dataSource) .ViewMode(ViewModes.INTERACTIVE) .ScaleMode(ScaleModes.FIT_PAGE_WIDTH) .Scale(1.0) .PersistSession(false) ) 

There seems to be no way to do this directly when using the MVC version.

0
source share

In .cshtml as the title you have @model yourModel

Then to create a report you have:

  UriReportSource urs = new UriReportSource (){ Uri = "Report1.trdx" }; urs.Parameters.Add("id", Model.id.ToString()); urs.Parameters.Add("start", Model.Start.ToString()); urs.Parameters.Add("end", Model.Stop.ToString()); @(Html.TelerikReporting().ReportViewer() .Id("reportViewer1") .ServiceUrl("/api/reports/") .TemplateUrl("/ReportViewer/templates/telerikReportViewerTemplate.html") .ReportSource(urs) .ViewMode(ViewModes.INTERACTIVE) .ScaleMode(ScaleModes.SPECIFIC) .Scale(1.0) .PersistSession(false)) 

And the Model.cs file:

  public class yourModel { public Guid id{ get; set; } public DateTime Start { get; set; } public DateTime Stop { get; set; }} 

So I did it, hope it helps :)

0
source share

If all the options are installed, most likely the problem is Newtonsoft.Json.dll. Your problematic project most likely references the GAC version of Newtonsoft. To check if Newtonsoft is installed in the GAC, and uninstall it if so. For a quick fix, simply remove the Newtonsoft link from your project and add it using nuget.

0
source share

All Articles