Tuesday, November 19, 2013

Telerik Reports for ASP.NET MVC 4 Caching issue.


I recently used Telerik reports, and i got into a problem where report viewer cached the previous versions other than refreshing the report.

I followed the sample in below link from telerik in order to generate my report.

http://www.telerik.com/help/reporting/mvc-report-viewer-extension-embedding.html

below is the code from my report viewer.

@(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1")
        .ServiceUrl("/api/reports/")
        .TemplateUrl("/Content/ReportViewer/templates/telerikReportViewerTemplate.html")
        .ReportSource(new TypeReportSource() { TypeName = "MvcReportApplication.MyReport.Report5, MvcReportApplication" })
        .ViewMode(ViewModes.INTERACTIVE)
        .ScaleMode(ScaleModes.SPECIFIC)
        .Scale(1.0)
        .PersistSession(true)
       
)

To disable the report viewer caching just change PersistSession(true) to PersistSession(false) and you are good to go.


1 comment:
Write comments
Recommended Posts × +