or
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Reports.aspx.vb" Inherits="NJC.WasteMonitor.Web.Gen.Reports" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <telerik:RadStyleSheetManager ID="pgRadStyleSheetManager" runat="server"></telerik:RadStyleSheetManager> <telerik:RadScriptManager ID="pgRadScriptManager" runat="server"></telerik:RadScriptManager> <telerik:ReportViewer ID="uxReportViewer" runat="server" Width="100%" Height="500px" Skin="Office2007"></telerik:ReportViewer> <telerik:RadButton ID="uxLoginButton" Text="Test" runat="server" UseSubmitBehavior="false" OnClick="uxLoginButtonClick" CausesValidation="false"></telerik:RadButton> <telerik:RadAjaxManager ID="uxRadAjaxManager" runat="server" > <AjaxSettings> <telerik:AjaxSetting AjaxControlID="uxLoginButton"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="uxReportViewer" LoadingPanelID="uxLoadingPanel" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="uxReportViewer"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="uxReportViewer" LoadingPanelID="uxLoadingPanel" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="uxLoadingPanel" runat="server"></telerik:RadAjaxLoadingPanel> </form> </body></html>Partial Public Class Reports Inherits System.Web.UI.Page Protected Sub uxLoginButtonClick(ByVal sender As Object, ByVal e As EventArgs) Dim _report As WasteReportReport = New WasteReportReport(GetWasteMonitorConnectionString, "4,5,2", _ 1, _ CDate("01-Aug-2014"), _ CDate("06-Aug-2014"), _ "", _ "", _ "", _ "", _ "") ' Define a reportsource and add the report to it Dim _instanceReportSource As Telerik.Reporting.InstanceReportSource = New Telerik.Reporting.InstanceReportSource() _instanceReportSource.ReportDocument = _report ' Add the report source to the report viewer uxReportViewer.ReportSource = _instanceReportSource End SubEnd Class
Order tempOrder = new Order("12345", "Mr Test"); Telerik.Reporting.Report report = new Telerik.Reporting.Report(); report.DataSource = tempOrder; System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); UriReportSource reportSource = new UriReportSource(); reportSource.Uri = @"E:\Program Files (x86)\Telerik\Reporting Q2 2014\Report Designer\Examples\Order.trdx"; Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo); string fileName = result.DocumentName + "." + result.Extension; string path = System.IO.Path.GetTempPath(); string filePath = System.IO.Path.Combine(path, fileName); using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); }