public ActionResult ReportTest() { using (UOSEntities db = new UOSEntities()) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(900); reportViewer.Height = Unit.Percentage(900); var DBvlu = db.AJ_Stud_Admin_Return_Reg_C(2); // var DBvlu = db.Aj_Aff_Ins_Admin_Fee_slip(2); // var DBvlu = db.Stud_Admin_Basic_info(1); // reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/rdlc_Stud_Admin_Return_Reg_A.rdlc"); // reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_Affi_reg_return_Anax_C.rdlc"); ; reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_aff_reg_chak_list.rdlc");; //reportViewer.LocalReport.DataSources.Add(new ReportDataSource("AJ_Stud_Admin_Return_Reg_A", DBvlu)); //reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_Student_info_fr_Admin.rdlc"); //reportViewer.LocalReport.DataSources.Add(new ReportDataSource("Stud_Admin_Basic_info", DBvlu)); //reportViewer.LocalReport.DataSources.Add(new ReportDataSource("Rdlc_Affi_reg_return_Anax_C", DBvlu));//Rdlc_aff_reg_chak_list reportViewer.LocalReport.DataSources.Add(new ReportDataSource("Rdlc_aff_reg_chak_list", DBvlu));//Rdlc_aff_reg_chak_list //reportViewer.LocalReport.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_Reg_Admin_Fee_Slip.rdlc"); //reportViewer.LocalReport.DataSources.Add(new ReportDataSource("Aj_Aff_Ins_Admin_Fee_slip", DBvlu)); ViewBag.ReportViewer = reportViewer; return(View()); } }
public ActionResult DownloadAnex(int RntID) { byte[] bytes = null; //if (returnId == null) // returnId = "0"; //int catg = Convert.ToInt32(returnId.Substring(0, 1)); //int RntID = Convert.ToInt32(returnId.Substring(1, returnId.Length - 1)); string DocumetNAme = ""; Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport(); var DBvlu = db.AJ_Stud_Admin_Return_Reg_C(RntID); rpt.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_Affi_reg_return_Anax_C.rdlc"); rpt.DataSources.Add(new ReportDataSource("Rdlc_Affi_reg_return_Anax_C", DBvlu)); DocumetNAme = "Annex-C" + "." + "PDF"; rpt.GetDefaultPageSettings(); bytes = rpt.Render("PDF"); // bytes = rpt.Render("PDF"); if (bytes.Length > 0) { Response.Buffer = true; Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=" + DocumetNAme); Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file Response.Flush(); // send it to the client to download Response.End(); // return View(); } return(RedirectToAction("ReturnStatus", "Registration")); }