Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
CSS
<div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <rsweb:ReportViewer ID="rvAgreement"  runat="server" InteractiveDeviceInfos="(Collection)" Height="274px" Width="319px">
                <LocalReport ReportPath="rwAgreement.rdlc">
                </LocalReport>
            </rsweb:ReportViewer>
        </div>


=========================================

C#
#region Bind ReportViewer
       public void bindPrintProvisionReportPdfP()
       {
           try
           {
               belrr.FROM_DATE = Convert.ToDateTime(Request.QueryString["strFD"].ToString());
               belrr.TO_DATE = Convert.ToDateTime(Request.QueryString["strTD"].ToString());
               belrr.CRN = Request.QueryString["strCRN"].ToString();

               ds = blladr.FETCH_PROVISION_REPORT(belrr);

               if (ds.Tables[0].Rows.Count > 0)
               {
                   DataTable dt = new DataTable();
                   dt = ds.Tables[0];

                   rptvPrintProvisionReportPdfP.LocalReport.ReportPath = "rwPrintProvisionReportPdfP.rdlc";

                   rptvPrintProvisionReportPdfP.LocalReport.DataSources.Clear();
                   var reportDataSource1 = new ReportDataSource("dsPrintProvisionReportPdfP", dt);
                   rptvPrintProvisionReportPdfP.ProcessingMode = ProcessingMode.Local;
                   rptvPrintProvisionReportPdfP.LocalReport.EnableExternalImages = true;
                   rptvPrintProvisionReportPdfP.LocalReport.DataSources.Add(reportDataSource1);
                   rptvPrintProvisionReportPdfP.LocalReport.Refresh();
                   //rptvPrintDAFP.Visible = true;

                   string fileName = "Provision_Report_" + belrr.CRN.ToString();
                   Warning[] warnings;
                   string[] streamIds;
                   string mimeType = string.Empty;
                   string encoding = string.Empty;
                   string extension = string.Empty;

                   byte[] bytes = rptvPrintProvisionReportPdfP.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

                   // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
                   Response.Buffer = true;
                   Response.Clear();
                   Response.ContentType = mimeType;
                   Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
                   Response.BinaryWrite(bytes); // create the file
                   Response.Flush(); // send it to the client to downlo
               }
           }
           catch (Exception ex)
           {
               throw ex;
           }
       }
       #endregion


===========================================
Posted
Updated 2-Jan-15 20:30pm
v4
Comments
Richard Deeming 12-Nov-14 11:09am    
Is there supposed to be a question hiding in that code-dump?

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900