Setup Designer with Data
Posted: Wed Mar 18, 2015 7:45 pm
I have an MVC project that we would like to add reporting to. I want to allow users to create new mrt files within the designer and just pass the data source to it. How can I open the designer without pre-defining a report? The code below opens the designer but does not have the data source populated and just keeps throwing "Error: Internal Server Error" messages:
View:
Controller:
View:
Code: Select all
@Html.Stimulsoft().StiMvcMobileDesigner(
"StimulsoftDesigner1",
new StiMvcMobileDesignerOptions
{
ActionGetReportTemplate = "GetReportTemplate",
ActionGetReportSnapshot = "GetReportSnapshot",
ActionSaveReportTemplate = "SaveReportTemplate"
})
Code: Select all
public ActionResult GetReportTemplate()
{
StiReport report = new StiReport();
DataTable dt = (DataTable)Session["ReportSource"];
report.RegData(dt);
return StiMvcMobileDesigner.GetReportTemplateResult(HttpContext, report);
}
public ActionResult GetReportSnapshot()
{
StiReport report = StiMvcMobileDesigner.GetReportObject(HttpContext);
// Register data, if necessary
DataTable dt = (DataTable)Session["ReportSource"];
report.RegData(dt);
// Return the report snapshot result to the client
return StiMvcMobileDesigner.GetReportSnapshotResult(HttpContext, report);
}
public ActionResult SaveReportTemplate()
{
StiReport report = StiMvcMobileDesigner.GetReportObject(HttpContext);
report.Save(@"D:\" + report.ReportName + ".mrt");
return StiMvcMobileDesigner.SaveReportTemplateResult(HttpContext);
}