Can't save changes. Report always empty

Stimulsoft Reports.WEB discussion
Post Reply
pawelg
Posts: 3
Joined: Thu Mar 17, 2016 11:00 am

Can't save changes. Report always empty

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Can't save changes. Report always empty

Post 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.
pawelg
Posts: 3
Joined: Thu Mar 17, 2016 11:00 am

Re: Can't save changes. Report always empty

Post 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
pawelg
Posts: 3
Joined: Thu Mar 17, 2016 11:00 am

Re: Can't save changes. Report always empty

Post 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
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Can't save changes. Report always empty

Post by HighAley »

Hello.

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

Thank you.
Post Reply