Crystalreports version 13.0.2000 does not export

Asked

Viewed 92 times

0

I am with a project webforms . NET 4.5, with reports using the Crystal Reports version 13.0.2000. Reports do not export, do not explode exceptions, nothing, simply the screen makes a refresh of postback and nothing happens.

  • Are you using the standard component to show the report or are creating an export routine?

  • Standard component, the export button of Crystalreportviewer itself

1 answer

0

Resolved, below is the resolution.

<cr:CrystalReportViewer 
    ID="CrystalReportViewer1" runat="server" AutoDataBind="true" 
    OnDataBinding="CrystalReportViewer1_DataBinding" ToolPanelView="None" 
    HasCrystalLogo="False" HasDrilldownTabs="False"   
    HasDrillUpButton="False" HasPrintButton="False" HasSearchButton="False" 
    HasToggleGroupTreeButton="false" HasZoomFactorList="False" 
/>

And in the aspx.Cs file:

protected void CrystalReportViewer1_DataBinding(object sender, EventArgs e)
{
    if (ValidaParametros() && IsPostBack)
        CarregaRelatorio();
}

protected void btnBusca_Click(object sender, EventArgs e)
{
    CrystalReportViewer1.DataBind();
}

private void CarregaRelatorio()
{
    DataSet ds = new DataSet();

    try
    {
        ds = BuscaDadosRelatorio();
        if (ds.Tables[0].Rows.Count == 0)
            ValidationError.Display(btnBusca, "Não há registros para o critério de busca informado.", ValidationType.Exclamation);

        ReportDocument report = new ReportDocument();
        switch (ddlExibicao.SelectedValue)
        {
            case "1":
                report.FileName = "RelLancamentoEstorno.rpt";
                break;
            case "2":
                report.FileName = "RelLancamentoInadimplente.rpt";
                break;
            default:
                report.FileName = "RelLancamento.rpt";
                break;
        }
        string reportLoadPath = BuscaParametro();
        report.Load(Path.Combine(reportLoadPath, Path.GetFileName(report.FileName)));
        report.SetDataSource(ds.Tables[0]);
        CrystalReportViewer1.ReportSource = report;
    }
    catch
    {
        ValidationError.Display(btnBusca, "Falha ao carregar os dados do relatório.", ValidationType.Sucess);
    }
}

What happened was the following, the "Upload Report" method was initially called in the event click the search button, but it did not work. Then I created the event "Ondatabinding" in the Crystal component and in the event click the button search command to execute the "Crystalreportviewer1.Databind" which in turn triggers the event "Ondatabinding", which makes the call to the method "Load report". With the flow exactly like this (I tried many other things, using in various ways the life Cycle of the page) I managed to get the thousands of bugs to be automatically solved, paging, exporting, printing, js errors, Anyway, that was the solution I found I hope it helps.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.