vendredi 4 décembre 2015

Set dynamic name for exported file from crystal viewer c#

Now I need to set name for downloaded file from crystal viewer c#, I've tried this code after search but it is not working

protected void Page_Init(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        ReportDocument doc = (ReportDocument)Session["ReportView"];
        doc.SummaryInfo.ReportTitle = ((ReportDocument)Session["ReportView"]).SummaryInfo.ReportTitle;//"MyVeryOwnExportFile";
        CrystalReportViewer1.ReportSource = doc;
        CrystalReportViewer1.BestFitPage = false;
    }
    else
    {
        ReportDocument doc = (ReportDocument)Session["ReportView"];
        doc.SummaryInfo.ReportTitle = "MyVeryOwnExportFile";
        CrystalReportViewer1.ReportSource = doc;
    }
}

And when I tried this code to set dynamic name for exported file by this way it's working but affects on viewer and next page become not work after this change

CrystalReportViewer1.ID="downloaded file name";

after this line I can download file with dynamic names but next page option in view become not working.

Aucun commentaire:

Enregistrer un commentaire