I want to set a subreport at my main report but there is something wrong with my dataset of subreport. The action of my main report.
public ActionResult ExibirRelatorioProgramaSol(FormCollection form)
{
DateTime dtInicial = DateTime.Parse(form["dt_inicio"]);
DateTime dtFinal = DateTime.Parse(form["dt_fim"]);
int idLista = form["ddl_Lista"].ConvertValueForm<int>();
var avaliacao = _appServicoAvaliacaoSetor.ObterAvaliacoes(dtInicial, dtFinal, idLista);
var relatorio = _appServicoAvaliacaoSetor.GerarRelatorioProgramaSol(dtInicial, dtFinal, idLista);
var viewer = new Microsoft.Reporting.WebForms.ReportViewer();
viewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
viewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + "/Report/ReportProgramaSol.rdlc";
viewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(RenderizaSubRelatorioPedido);
viewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ProgramaSol", relatorio.ToList()));
viewer.SizeToReportContent = true;
viewer.Width = System.Web.UI.WebControls.Unit.Percentage(100);
viewer.Height = System.Web.UI.WebControls.Unit.Percentage(100);
ViewBag.ReportViewer = viewer;
return View();
}
The action of my subreport:
private void RenderizaSubRelatorioPedido(object sender, SubreportProcessingEventArgs e)
{
int idEmpresa = Convert.ToInt32("2");
e.DataSources.Add(new ReportDataSource("empresa",
_appServicoEmpresa.ObterEntidadePor(i => i.Id == idEmpresa)));
}
The error:
Failure data recovery for the sub- report ' subreport1 ' , located at: C : \ Projects \ Samich \ VisualStudioOnLine \ Vanessa \ Samich Projects C # \ EMS - Audit Management System - Copy \ EMS - Audit Management System \ Report \ ReportHeader.rdlc . Check the log files for more information .
Can someone help me?