2017-02-28 26 views
0

的多個結果我不得不做出一個列表框報告,其中多個結果選擇的ReportViewer列表框

Image

但是當我到DataTable我不知道如何使它顯示結果的不同價值觀。選定的。 這是我的代碼...

protected void CargaReporte(object sender, EventArgs e) 
    { 
     dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable dt = new dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable(); 
     dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter da = new dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter(); 
     ReportDataSource RD = new ReportDataSource(); 
     List<dynamic> lst = new List<dynamic>(); 
     if (ddUsu.SelectedIndex == 0) 
     { 
      foreach (ListItem item in ddUsu.Items) 
      { 
       if (item.Selected) 
       { 
        da.Fill(dt, int.Parse(ddUsu.SelectedValue)); 
        lst.Add(dt); 
       } 
      } 
     } 
     else 
     { 
      da.Fill(dt, int.Parse(ddUsu.SelectedValue == "" ? "0" : ddUsu.SelectedValue)); 
     } 
     divReporte.Visible = true; 

     RD.Value = lst.ToArray(); 
     RD.Name = "dbCalendarioEventos"; 
     rvReporteCalendarioEventos.LocalReport.DataSources.Clear(); 
     rvReporteCalendarioEventos.LocalReport.DataSources.Add(RD); 
     rvReporteCalendarioEventos.LocalReport.ReportEmbeddedResource = "ReporteCalendarioEventos.rdlc"; 
     rvReporteCalendarioEventos.LocalReport.ReportPath = @"Reportes\Calendario\ReporteCalendarioEventos.rdlc"; 
     rvReporteCalendarioEventos.LocalReport.Refresh(); 
    } 

如何填寫具有兩個或多個結果的報告?

+0

我看不到在點擊鏈接的任何圖像。你可以確認嗎? –

+0

https://i.stack.imgur.com/HHcHr.png是一個組合框的圖像,我附加了圖像的URL –

回答

0

解決:

創建一個額外的數據表,以節省通過的foreach路徑後設置的信息,所以我可以得到我共享代碼的部分結果。

string participante = (txtParticipante.Value == "" ? " " : txtParticipante.Value); 
     dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable dt = new dsReportes.SP_REPORTE_EVENTOS_CALENDARIODataTable(); 
     DataTable table = new DataTable(); 
     dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter da = new dsReportesTableAdapters.SP_REPORTE_EVENTOS_CALENDARIOTableAdapter(); 
     ReportDataSource RD = new ReportDataSource(); 
     table = dt.Clone(); 
     var FechaInicio_ini = FechaInicio(CEV_FECHA_INICIO_ini.Value); 
     var FechaInicio_fin = FechaFin(CEV_FECHA_INICIO_fin.Value); 
     var FechaFin_ini = FechaInicio(CEV_FECHA_FIN_Ini.Value); 
     var FechaFin_fin = FechaFin(CEV_FECHA_FIN_fin.Value); 

     try 
     { 
      if (ddUsu.SelectedValue != "") 
      { 
       foreach (ListItem item in ddUsu.Items) 
       { 
        if (item.Selected == true) 
        { 
         da.Fill(dt, int.Parse(item.Value), 
           FechaInicio_ini, FechaInicio_fin, 
           FechaFin_ini, FechaFin_fin,(txtParticipante.Value == "" ? " " : txtParticipante.Value)); 
         foreach (DataRow dr in dt) 
         { 
          table.Rows.Add(dr.ItemArray); 
         } 
        } 
       } 
      } 
      else 
      { 
       foreach(ListItem item in ddUsu.Items) 
       { 
        da.Fill(dt, int.Parse(item.Value == "" ? "0" : item.Value), 
           FechaInicio_ini, FechaInicio_fin, 
          FechaFin_ini, FechaFin_fin, (txtParticipante.Value == "" ? " " : txtParticipante.Value)); 
        foreach (DataRow dr in dt) 
        { 
         table.Rows.Add(dr.ItemArray); 
        } 
       } 
      } 
      divReporte.Visible = true; 

      RD.Value = table; 
      RD.Name = "dbCalendarioEventos"; 
      rvReporteCalendarioEventos.LocalReport.DataSources.Clear(); 
      rvReporteCalendarioEventos.LocalReport.DataSources.Add(RD); 
      rvReporteCalendarioEventos.LocalReport.ReportEmbeddedResource = "ReporteCalendarioEventos.rdlc"; 
      rvReporteCalendarioEventos.LocalReport.ReportPath = @"Reportes\Calendario\ReporteCalendarioEventos.rdlc"; 
      rvReporteCalendarioEventos.LocalReport.Refresh(); 
     } 
     catch(Exception ex) { }    
    } 

image 2