Stimulsoft 报告未在 MVC 视图中加载
Stimulsoft report not load in MVC View
我尝试在 MVC 5 中使用 StimulSoftReport
。我在 stimulsoft 设计器中设计了一个 .mrt 文件。我有一个将打印报告的视图。
此视图文件包含以下代码:
@using Stimulsoft.Report.Mvc;
@{
ViewBag.Title = "چاپ قبض";
Layout = null;
}
@Html.Stimulsoft().StiMvcViewer(
"MvcViewerReport",
new Stimulsoft.Report.Mvc.StiMvcViewerOptions()
{
ActionGetReportSnapshot = "GetReportSnapshot",
ActionViewerEvent = "ViewerEvent"
})
打印操作与 GetReportSnapshot
和 ViewerEvent
位于同一控制器中。但是当显示打印视图时。它只有报告查看器的工具栏,即使我创建了一个断点也没有显示我的记者,我发现 none 从视图中调用了上述操作。
这里是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);
}
这里是 ViewerEvent
代码:
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult(HttpContext);
}
怎么回事? :(
您没有将数据传递给报表。只有模式。通常DataSet是用RegData()方法注册的。
不知道你的问题能不能解决?但我最近遇到了和你一样的问题,我正在使用 mvc 5.2.3,我用谷歌搜索但找不到合适的解决方案,所以我猜它需要更改 .dll 版本。
我将 dll 更改为 Stimulsoft.Suite.2015.2.Retail,问题已解决。
希望对您有所帮助。
我的问题通过将这部分代码添加到 web.config
上的 assemblyBinding 标记得到解决
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="2.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
我尝试在 MVC 5 中使用 StimulSoftReport
。我在 stimulsoft 设计器中设计了一个 .mrt 文件。我有一个将打印报告的视图。
此视图文件包含以下代码:
@using Stimulsoft.Report.Mvc;
@{
ViewBag.Title = "چاپ قبض";
Layout = null;
}
@Html.Stimulsoft().StiMvcViewer(
"MvcViewerReport",
new Stimulsoft.Report.Mvc.StiMvcViewerOptions()
{
ActionGetReportSnapshot = "GetReportSnapshot",
ActionViewerEvent = "ViewerEvent"
})
打印操作与 GetReportSnapshot
和 ViewerEvent
位于同一控制器中。但是当显示打印视图时。它只有报告查看器的工具栏,即使我创建了一个断点也没有显示我的记者,我发现 none 从视图中调用了上述操作。
这里是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);
}
这里是 ViewerEvent
代码:
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult(HttpContext);
}
怎么回事? :(
您没有将数据传递给报表。只有模式。通常DataSet是用RegData()方法注册的。
不知道你的问题能不能解决?但我最近遇到了和你一样的问题,我正在使用 mvc 5.2.3,我用谷歌搜索但找不到合适的解决方案,所以我猜它需要更改 .dll 版本。 我将 dll 更改为 Stimulsoft.Suite.2015.2.Retail,问题已解决。
希望对您有所帮助。
我的问题通过将这部分代码添加到 web.config
上的 assemblyBinding 标记得到解决<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="2.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>