Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try //add trycatch
            {
                string rutatarget = WebConfigurationManager.AppSettings["RutaReportes"].ToString();
                List <MedidaMitigacionBE> listado = EscenarioRptLN.ListaEscenariosRptGeneral(int.Parse(ddlAnnio.SelectedValue));

                ReportDataSource dataSource = new ReportDataSource("DtMedGeneral", listado);
                ReportViewer1.ProcessingMode         = ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = string.Format("{0}\\rptMedGeneral.rdlc", rutatarget);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(dataSource);

                if (listado != null)
                {
                    ReportViewer1.Visible = true;
                    ReportViewer1.LocalReport.Refresh();
                }
                else
                {
                    ReportViewer1.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }