How to solve infinite load cycle in a report viewer?

1

I'm trying to create a web report on a .aspx page, the report template is a .rdlc file. When I run the application, I fill out a bar graph with the same Datasource that I use for the report, however my report remains cycled in loading, calling the application again as if it were updating the page:

the code with which I fill out the report is as follows:

DataTable datos = new DataTable();
            string cs = ConfigurationManager.ConnectionStrings["OCEntities"].ConnectionString;
            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand comm = new SqlCommand("select * from Vista_ReporteCompras ", con);
                SqlDataAdapter da = new SqlDataAdapter(comm);
                da.Fill(datos);
            }
            visor.ProcessingMode = ProcessingMode.Local;
            visor.LocalReport.ReportPath = Server.MapPath("Plantilla.rdlc");
            ReportDataSource datasource = new ReportDataSource("Datos", datos);
            visor.LocalReport.DataSources.Clear();
            visor.LocalReport.DataSources.Add(datasource);
            cargar = false;

Do you have an idea how to solve it?

    
asked by German AT 07.11.2018 в 22:51
source

1 answer

1

According to this response in Stack Overflow , your error may be due because you have not implemented the PostBack in your source code.

Example:

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    {
        // Report data source code...
        myReport.LocalReport.Refresh();
    }
}
    
answered by 08.11.2018 / 15:43
source