<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <telerik:RadCodeBlock runat="server"> <script type="text/javascript"> ReportViewer.prototype.PrintReport = function() { this.PrintAs("Default"); } function MyPrint() { <%=ReportViewer1.ClientID %>.PrintReport(); } </script> </telerik:RadCodeBlock> <script type="text/javascript"> ReportViewer.OnReportLoadedOld = ReportViewer.OnReportLoaded; ReportViewer.prototype.OnReportLoaded = function () { this.OnReportLoadedOld(); var printButton = document.getElementById("PrintButton"); printButton.disabled = false; } </script></head><body> <form id="form1" runat="server"> <asp:ScriptManager runat="server" /> <div> <asp:Button ID="Button1" runat="server" Text="Print" OnClick="Button1_Click" Style="width: 41px" /> <asp:Button ID="PrintButton" runat="server" Text="Print Dialog Server" OnClick="PrintButton_Click" /> <asp:Button ID="PrintClient" runat="server" Text="Print Client" OnClientClick="MyPrint(); return false;" /> <telerik:ReportViewer ID="ReportViewer1" runat="server" Width="100%" Height="800px" Style="display:none"></telerik:ReportViewer> </div> </form></body></html>public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = new Report1(); this.ReportViewer1.ReportSource = instanceReportSource; } protected void Button1_Click(object sender, EventArgs e) { ExportToPDF(new Report1()); } void ExportToPDF(Telerik.Reporting.Report reportToExport) { ReportProcessor reportProcessor = new ReportProcessor(); Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); instanceReportSource.ReportDocument = reportToExport; Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null); string fileName = result.DocumentName + "." + result.Extension; Response.Clear(); Response.ContentType = result.MimeType; Response.Cache.SetCacheability(HttpCacheability.Private); Response.Expires = -1; Response.Buffer = true; Response.AddHeader("Content-Disposition", string.Format("{0};FileName=\"{1}\"", "attachment", fileName)); Response.BinaryWrite(result.DocumentBytes); Response.End(); } protected void PrintButton_Click(object sender, EventArgs e) { string printScript = string.Format("{0}.PrintReport();", this.ReportViewer1.ClientID); this.ClientScript.RegisterStartupScript(this.GetType(), "ReportPrint", printScript, true); } }
var products = Products.Where(x => x.IsSelected);
Custom business object
DistributionCompilation distribution = new DistributionCompilation();
Populating the business object
distribution.BuildSingleBrandDistributionRport(products, SelectedStart, SelectedEnd, MinBottles, NoBuyPeriod, SelectedBrand.Name);
Setting it as the source for the report
NewDistributions distribution_report = new NewDistributions();
distribution_report.DataSource = distribution.ShowReport();
_View.Report = distribution_report;
Hello everyone. I have a situation where I have created a master summary report with 2 detail sub reports in it. One of my 2 sub reports refuses to show any data. It is configured the same as the 2nd sub report with its parameters properly being passed along but I get bupkis.
I can run the sub report in question by its self and it will display data beautifully but not when I add it as a sub report to my master report.
I found some code while searching the forum to display a custom message when my sub report has no data and using that I have verified that the sub report is just not getting any data back when run.
Any ideas here to help me get over this hump?