Save As dialog being ignored C# MVC

Stimulsoft Reports.NET discussion
Post Reply
GWinter
Posts: 1
Joined: Tue Jun 21, 2016 2:32 pm

Save As dialog being ignored C# MVC

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Save As dialog being ignored C# MVC

Post 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.
Post Reply