我有一个报告,由stimulsoft在asp.net核心中创建 然后在视图中设置此操作:
@using Stimulsoft.Report.Mvc;
@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Actions =
{
GetReport = "GetReport",
PrintReport = "PrintReport",
ViewerEvent = "ViewerEvent"
}
})
并进行3次操作:
public async Task<IActionResult> PrintInsurance(int id)
{
return View();
}
需要id参数来加载报告信息。
public ActionResult GetReport()
{
var insurance = await _insuranceService.GetInsuranceForEdit(id);
StiReport report = new StiReport();
report.Load(StiNetCoreHelper.MapPath(this,
"wwwroot/Reports/PrintInsurance.mrt"));
report.RegData("dt", insurance);
return StiNetCoreViewer.GetReportResult(this, report);
}
在上述操作中,我如何获取ID?
,然后执行打印报告操作:
public async Task<IActionResult> PrintReport()
{
//Change State To Printed
bool result = await _insuranceService.ChangeToPrinted((int)id,User.Identity.Name);
return StiNetCoreViewer.PrintReportResult(this);
}
在上述操作中,我再次需要ID。如何获取ID值??
答案 0 :(得分:0)
在报告中将“ ID”定义为变量,然后在加载报告之前尝试在代码中添加它:
string ID = "ID";
report.Dictionary.Variables("ID").Value = ID;