<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>
#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
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)