Page 1 of 1

Can't save changes. Report always empty

Posted: Thu Mar 17, 2016 11:30 am
by pawelg
Hello,
I'am creating new project with standard Visual Studio 2015 template. I can't save report on server side. After doing some changes in desinger I click save. Action on controller is executed, but I can't access report object. StiMvcDesigner.GetReportObject(this.Request) gives me always empty result. When I save report throught Save As button I get correct file. What can I do to find an error.
My controller code:

Code: Select all

        public ActionResult GetPrintTemplate(string id)
        {

            var report = new StiReport();

            using (System.IO.StreamReader sr = new System.IO.StreamReader(_ReportPath))
            {
                var data = sr.ReadToEnd();
                report.LoadFromString(data);
            }
            return StiMvcDesigner.GetReportTemplateResult(report);
        }

        public ActionResult GetPrintSnapshot(string id)
        {
            StiReport report = StiMvcDesigner.GetReportObject(this.Request);
          
            return StiMvcDesigner.GetReportSnapshotResult(this.Request, report);// (this.Request, report);
        }

        public ActionResult SavePrintTemplate(string id)
        {
            StiReport report = StiMvcDesigner.GetReportObject(this.Request); //// HERE I GET ALWAYS EMPTY REPORT 
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(_ReportPath))
            {
                sw.Write(report.SaveDocumentToString());
            }
            return StiMvcDesigner.SaveReportResult(false);
        }
And view:

Code: Select all

@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions()
{
    ActionGetReportTemplate = "GetPrintTemplate",
    ActionGetReportSnapshot = "GetPrintSnapshot",
    ActionSaveReportTemplate = "SavePrintTemplate",
    Height = Unit.Pixel(800),
    Width = Unit.Percentage(100),
    AllowModifyConnections = true,
    AllowModifyDataSources = true,
    AllowModifyDictionary = true,
    //LocalizationDirectory = "~/App_Data/ReportsLocalization/",
    //Localization = locationName,
    // ActionGetLocalization = "GetLocalization",
    Theme = StiMvcDesignerOptions.Themes.Blue,
    ConnectionClientRequestTimeout = 1000000
})
Best reagards

Re: Can't save changes. Report always empty

Posted: Fri Mar 18, 2016 7:26 am
by HighAley
Hello.

We have checked your code on 2016.1 build and could not reproduce the issue.
Please, look at the attached sample where your code is used.
https://drive.google.com/file/d/0BxTYlh ... sp=sharing

Thank you.

Re: Can't save changes. Report always empty

Posted: Fri Mar 18, 2016 11:43 am
by pawelg
Hello,
thank You for sample project. It helped me to find my mistake. I used SaveDocumentToString() instead of report.save. That's why i thought report object is empty.
Best regards

Re: Can't save changes. Report always empty

Posted: Fri Mar 18, 2016 11:43 am
by pawelg
Hello,
thank You for sample project. It helped me to find my mistake. I used SaveDocumentToString() instead of report.save. That's why i thought report object is empty.
Best regards

Re: Can't save changes. Report always empty

Posted: Fri Mar 18, 2016 1:15 pm
by HighAley
Hello.

We are always glad to help you.
Let us know if you need our help.

Thank you.