or
| var report = new TelerikComponentsWS.Reports.RepFeeReceipt(); |
| report.DataSource = printdata; |
| Telerik.Reporting.Drawing.ExternalStyleSheet exx = new Telerik.Reporting.Drawing.ExternalStyleSheet("~\\css\\ReprotStyleSheet.xml"); |
| report.ExternalStyleSheets.Add(exx); |
| report.ReportParameters[0].Value = strTitle; |
| Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); |
| Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", report, null); |
| string fileName= result.DocumentName + ".pdf"; |
| System.Web.HttpContext.Current.Response.Clear() ; |
| System.Web.HttpContext.Current.Response.ContentType = result.MimeType; |
| System.Web.HttpContext.Current.Response.Cache.SetCacheability( System.Web.HttpCacheability.Private) ; |
| System.Web.HttpContext.Current.Response.Expires = -1 ; |
| System.Web.HttpContext.Current.Response.Buffer =true; |
| private void ghDO_ItemDataBound(object sender, EventArgs e) |
| { |
| //Get the group section object from sender |
| Telerik.Reporting.Processing.GroupSection groupSection = (Telerik.Reporting.Processing.GroupSection)sender; |
| //From the group section object get the current DataRow |
| System.Data.DataRow row = (System.Data.DataRow)groupSection.DataObject.RawData; |
| //If Previous DO is not equal to current DO. Page Number reset to 1. |
| if (OldDO != null && OldDO != groupSection.DataObject["do_no"].ToString()) |
| { |
| |
| pageNumber = 1; |
| } |
| else |
| { |
| pageNumber = pageNumber + 1; |
| } |
| OldDO = groupSection.DataObject["do_no"].ToString(); |
| pageNo.Value = pageNumber.ToString(); |
| } |
| if (e.CommandName == "Print") |
| { |
| int? fee_receipt_id = int.Parse(e.CommandArgument.ToString()); |
| int? status_code = null; |
| int? call_user_id = LogonDetails.Instance.sys_lclvar_user_id; |
| int? call_screen_id = GetScreenId(); |
| int? session_id = LogonDetails.Instance.sys_lclvar_session_id; |
| string call_ip_address = CommonMethods.CurrentIP; |
| bool? audit_report_execution = LogonDetails.Instance.sys_lclvar_audit_user_action; |
| bool? audit_user_action = LogonDetails.Instance.sys_lclvar_audit_user_action; |
| string status_text = String.Empty; |
| var printdata = ReportsManager.get_report_fee_receipt( |
| fee_receipt_id, call_screen_id, call_user_id, session_id, call_ip_address, audit_user_action, audit_report_execution, ref status_code, ref status_text); |
| if ((!status_code.HasValue) || (status_code.Value != 0)) |
| { |
| DisplayMessage(false, status_text); |
| return; |
| } |
| string strTitle = LogonDetails.Instance.sys_lclvar_facility_name; |
| var report = new TelerikComponentsWS.Reports.RepFeeReceipt(); |
| report.DataSource = printdata; |
| Telerik.Reporting.Drawing.ExternalStyleSheet exx = new Telerik.Reporting.Drawing.ExternalStyleSheet("~\\css\\ReprotStyleSheet.xml"); |
| report.ExternalStyleSheets.Add(exx); |
| report.ReportParameters[0].Value = strTitle; |
| using (System.Windows.Forms.PrintDialog printDlg = new System.Windows.Forms.PrintDialog()) |
| { |
| printDlg.AllowSomePages = true; |
| printDlg.AllowCurrentPage = false; |
| printDlg.UseEXDialog = true; |
| if (System.Windows.Forms.DialogResult.OK == printDlg.ShowDialog()) |
| { |
| Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); |
| reportProcessor.PrintReport(report, printDlg.PrinterSettings); |
| } |
| } |
| ////Telerik.Reporting.Processing |
| //System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings(); |
| //// Adjust the printer settings if necessary... |
| //System.Drawing.Printing.PrintController standardPrintController = new System.Drawing.Printing.StandardPrintController(); |
| //printerSettings.PrinterName = "MyHomePrinter"; |
| //// Print the report using the printer settings. |
| //Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); |
| //reportProcessor.PrintController = standardPrintController; |
| //reportProcessor.PrintReport(report, printerSettings); |
| } |