Search code examples
asp.net-mvc-5stimulsoft

Stimulsoft report not load in MVC View


I have tried to use StimulSoftReport in MVC 5. I have designed an .mrt file in stimulsoft designer. I have a view which will print the report. This view file contains this code:

@using Stimulsoft.Report.Mvc;
@{
    ViewBag.Title = "چاپ قبض";
    Layout = null;
}
@Html.Stimulsoft().StiMvcViewer(
"MvcViewerReport",
new Stimulsoft.Report.Mvc.StiMvcViewerOptions()
{
    ActionGetReportSnapshot = "GetReportSnapshot",
    ActionViewerEvent = "ViewerEvent" 

})

The print Action located in same controller as GetReportSnapshot and ViewerEvent . But when Print View shown. It just have toolbar of report viewer and doesn't show my reporter even I create a break point and I found that none of above actions called from the view.

here is the code of GetReportSnapshot :

public ActionResult GetReportSnapshot()
        {
            DataSet dataset = new DataSet();
            dataset.ReadXmlSchema(Server.MapPath("~/Content/report/BillXmlFile.xsd"));
            StiReport report = new StiReport();
            report.Load(Server.MapPath("~/Content/report/Report.mrt"));
            report.Dictionary.ImportXMLSchema(dataset);
            report.Compile();                        
            return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
        }

and here is the ViewerEvent code :

public ActionResult ViewerEvent()
        {
            return StiMvcViewer.ViewerEventResult(HttpContext);
        }

What is the matter ? :(


Solution

  • my problme fix by adding this part of code to assemblyBinding tag on web.config

    <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="2.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
    </dependentAssembly>