retrieve filename in SaveReport

Stimulsoft Reports.WEB discussion
Post Reply
Sat
Posts: 1
Joined: Fri Apr 17, 2009 2:30 am

retrieve filename in SaveReport

Post by Sat »

Problem with saving report from designer. String e.Report.ReportFile is always empty.

Why e.Report.ReportFile always is empty?
Where can I get fileName in SaveReport method?
I cant use Session for it in my project.

Code: Select all

protected void Page_Load(object sender, EventArgs e)
{
        stiReportDesigner1.SaveReport += StiWebDesigner1_SaveReport;
        if (!Page.IsPostBack && Page.Request.QueryString["stimulsoft_webdesigner"] == null)
        {
                string fileName = GetReportFileName(GetIdFromRequest());
                StiReport report = new StiReport();
                report.Load(fileName);                
                //report.ReportFile == fileName   <- correct!!!!
                stiReportDesigner1.Design(report);
        }   
}

void StiWebDesigner1_SaveReport(object sender, StiWebDesigner.StiSaveReportEventArgs e)
{
        string fileName = e.Report.ReportFile;  // <-- e.Report.ReportFile always empty
        if (!string.IsNullOrEmpty(fileName))
        {
            e.Report.Save(fileName); 
        }
}
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

retrieve filename in SaveReport

Post by Andrew »

Hello.

Unfortunately, the ReportFile property is not serializable, and the report is passed to the designer as the .mrt file.
To save it, you can use either the Session (which is not good for you) or the Page.Cache.

Thank you.
Post Reply