Search results
Suggest a FeaturePDF

How to clear cache when closing the Report Viewer

By using the clearReportCache and destroy method, you can clear the server side cache. You have to use this method when closing report viewer and switching to another report within your application.

CSHTML

<div id="reportviewer"></div>
<script>
 var isSubmit = true;
 $(document.body).bind('submit', $.proxy(this.formSubmit, this));
function formSubmit(args)
{
        isSubmit = false;
}

window.onbeforeunload = function () {
if (isSubmit) {
var reportviewerObj = $("#reportviewer").data("boldReportViewer");
        reportviewerObj.clearReportCache();
        reportviewerObj.destroy();
}

isSubmit = true;

};
</script>

Web API

In the PostReportAction method, you have to collect the GC with ClearCache as shown in the following code sample.

public object PostReportAction([FromBody] Dictionary<string, object> jsonArray)
{
  bool isclearcache = false;
  if (jsonArray != null && jsonArray.ContainsKey("reportAction") && jsonArray["reportAction"].ToString() == "ClearCache")
  {
    isclearcache = true;
  }
  var reportresult = ReportHelper.ProcessReport(jsonArray, this, this._cache);
  if (isclearcache)
  {
      GC.Collect(); isclearcache = false;
  }

 return reportresult;
}
Contents
Having trouble getting help?Contact Support
Contents
Having trouble getting help?Contact Support