Page 1 of 1

retrieve filename in SaveReport

Posted: Fri Apr 17, 2009 3:24 am
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); 
        }
}

retrieve filename in SaveReport

Posted: Mon Apr 20, 2009 1:58 am
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.