Page 1 of 1

Save As dialog being ignored C# MVC

Posted: Tue Jun 21, 2016 2:39 pm
by GWinter
Hi

I am trying to use the report builder in our MVC project, it's all working well, apart from the fact that I cannot get it to save anything other then the default report template.

When I call the Save As (the same way as your example code), it appears to be posting correctly looking at the Form Data in Google Dev tools. However once it gets server-side and I use the following code as per your example:

StiReport report = StiMvcMobileDesigner.GetReportObject(HttpContext);
report.Save(Server.MapPath(path + report.ReportName + ".mrt"));

report.ReportName always comes back as "report.mrt".

Any idea what I could be doing wrong?

Kind Regards,
Gareth

Re: Save As dialog being ignored C# MVC

Posted: Wed Jun 22, 2016 11:06 am
by Alex K.
Hello,

Please try to use the following code:

Code: Select all

public ActionResult SaveAsReportTemplate()
        {
            StiReport report = StiMvcMobileDesigner.GetReportObject(HttpContext);

            Hashtable parameters = StiMvcMobileDesigner.GetHttpContextParameters(HttpContext);
            string fileName = parameters["reportFile"] as string;
            report.Save(@"d:\" + fileName);

            return StiMvcMobileDesigner.SaveAsReportTemplateResult(HttpContext);
        }
Thank you.