When I used it in my code it re-issues the pdf but returns the error in the position subreport.
Error:
The subreport 'attendance' could not be found at the specified location attendance. Please verify that the subreport has been published and that the name is correct.
My code:
public async Task<FileContentResult> Attendance(InputFilterDto input)
{
var path = $"{this.host.WebRootPath}\\Reports\\attendanceForUser.rdlc";
Stream reportDefinition = new FileStream(path, FileMode.Open, FileAccess.Read);
LocalReport report = new LocalReport();
var datasourses = await Datasourses(input);
foreach (var item in datasourses.DataSources)
{
report.DataSources.Add(item);
}
report.LoadReportDefinition(reportDefinition);
report.SubreportProcessing += (sender, e) =>
{
foreach (var item in datasourses.DataSources)
{
e.DataSources.Add(item);
}
};
byte[] pdf = report.Render("PDF");
var fileResult = new FileContentResult(pdf, "application/pdf")
{
FileDownloadName = DateTime.Now.ToString("yy-MM-dd-hh-mm")
};
return fileResult;
}
I asked gpt chat but it didn't help me to solve the problem