I´m trying to generate a report using a LinqDataSource, placed on a aspx page, and a LocalReport. The code speaks for himself:
//Creating report
Microsoft.Reporting.WebForms.LocalReport report = new Microsoft.Reporting.WebForms.LocalReport();
report.ReportPath = Request.PhysicalApplicationPath + @"path\To\report.rdlc";
report.DisplayName = "Ttile";
//Setting the data
//SetMyLinqDataSource();
myLinqDataSource.WhereParameters.Add(new Parameter("bla", avalue));
myLinqDataSource.Where = "field1 = @bla";
report.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("MyDataSetName", myLinqDataSource));
//delivering to web user
Microsoft.Reporting.WebForms.Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
//Here the databind should happen
byte[] bytes = report.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=Report.pdf");
Response.Flush();
Response.BinaryWrite(bytes);
Response.Flush();
The fact is that the generated report doesn´t have any data, it´s almost empty. I placed two events linked to onselecting and onselected, on the LinqDataSource, just to place breakpoints.
Debugging I noticed that they are triggered by report.Render, but inspecting the onselected event arguments, there are no data on Results property. The others properties are aleready set (Where, Select, WhereParameters etc.).
And the LinqDataSource is correctly configured, and does populate a dataList just after, for instance.
Is there a problem in the code that I´m missing?