Display (Render) RDLC Report in browser in ASP.Net MVC

Last Reply one year ago By dharmendr

Posted one year ago

Hello everyone,

I have a C# MVC application when I generate 1 report from a record it loads and works perfectly.

When I generate 2 or more reports that is supposed to open in the same PDF window they end up displaying on top of each other.

I'm not exactly sure why this is happening I have the page set 8.5 by 11 and correct side and ConsumeContainerWhitespace = true.

In the report my margin is ,,, so all 0.

Maybe one of you will see something that should be changed.

Here is my code.

case "Generate All":
    LocalReport localReport = new LocalReport()
        ReportPath = Server.MapPath("~/ReportForms/VirtualService3.rdlc")
    ReportDataSource rds = new ReportDataSource("Service_Fields", model.ListQuotes); 

    string reportType = "PDF";
    string mimeType, encoding, fileNameExtension;

    string deviceInfo =
        "<DeviceInfo>" +
        "   <OutputFormat>"+reportType+"</OutputFormat>" +
        "   <PageWidth>8.5in</PageWidth>" +
        "   <PageHeight>11in</PageHeight>" +
        "   <MarginTop>0.5in</MarginTop>" +
        "   <MarginLeft>0in</MarginLeft>" +
        "   <MarginRight>0in</MarginRight>" +
        "   <MarginBottom>0in</MarginBottom>" +

    Warning[] warnings;
    string[] streams;
    byte[] renderedBytes;

    renderedBytes = localReport.Render(
        out mimeType,
        out encoding,
        out fileNameExtension,
        out streams,
        out warnings);                   

    return File(renderedBytes, mimeType);
This question does not have replies that have been liked.