Imports FastReport Public Class Webreport Inherits System.Web.UI.Page Private Sub Webreport_InitComplete(sender As Object, e As System.EventArgs) Handles Me.InitComplete 'Me.RadTreeView1.ExpandAllNodes() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Try If Request.QueryString("Reportnr").ToString <> "" Then Dim dh As New clsDatahandling Dim ds As New DataSet ds = dh.Get_Tabledata("Select * from web_report where id=" + Request.QueryString("ReportNr"), False, True) show_report(ds.Tables(0).Rows(0).Item("SQL"), ds.Tables(0).Rows(0).Item("SQLType"), ds.Tables(0).Rows(0).Item("Reportdatei"), ds.Tables(0).Rows(0).Item("Dokumentnr").ToString) show_report(ds.Tables(0).Rows(0).Item("SQL"), ds.Tables(0).Rows(0).Item("SQLType"), ds.Tables(0).Rows(0).Item("Reportdatei"), ds.Tables(0).Rows(0).Item("Dokumentnr").ToString) Me.WebReport1.Visible = True Me.WebReport1.Zoom = 1 Else Me.WebReport1.Visible = False End If Me.RadListBox1.SelectedValue = Session("RadList1Value") Me.RadListBox2.SelectedValue = Session("RadList2Value") Catch End Try 'show_report("Berufsliste", "SP", "Berufsliste.frx") Else End If End Sub 'Protected Sub RadTreeView1_NodeClick(sender As Object, e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeClick ' Dim dh As New clsDatahandling ' Dim ds As New DataSet ' 'ds = dh.Get_Tabledata("Select * from web_report where id=" + Me.RadTreeView1.SelectedNode.Value, False, True) ' If ds.Tables(0).Rows(0).Item("Folder") = False Then ' Session("Reportnr") = Me.RadTreeView1.SelectedNode.Value ' 'Response.Redirect("~/Administration/Webreport.aspx?Reportnr=" + Me.RadTreeView1.SelectedNode.Value.ToString) ' End If 'End Sub Sub Open_Report(ByVal reportnr As Integer) Dim url As String = Server.MapPath("/default.aspx") Response.Write("") 'HttpContext.Current.Response.Write("") Exit Sub 'Page.ClientScript.RegisterStartupScript(Me.RadTreeView1.GetType.GetType, "New Windows", "window.open('" + url + "','','')", True) Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "New windows", "window.open('" + url + "','baba','')", True) End Sub Sub show_report(ByVal sql As String, ByVal sqltype As String, ByVal filename As String, dokumentnr As String) Try If dokumentnr <> "" Then If dokumentnr <> "-1" Then sql = sql.Replace("%DOKNR%", dokumentnr) End If Dim ds1 As New DataSet Dim ds As New DataSet Dim dh As New clsDatahandling If sqltype = "SP" Then ds = dh.Get_Tabledata(sql, True, False) Else If sqltype = "SQL" Then ds = dh.Get_Tabledata(sql, False, True) Else ds = dh.Get_Tabledata(sql, False, False) End If End If Me.WebReport1.Prepare() Me.WebReport1.ReportFile = "~/Reporting/" + filename Me.WebReport1.DataBind() Dim x As FastReport.Report = WebReport1.Report x.RegisterData(ds) Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub WebReport1_StartReport(sender As Object, e As System.EventArgs) Handles WebReport1.StartReport Dim dh As New clsDatahandling Me.WebReport1.Report.SetParameterValue("Parcours", dh.Get_Option(2)) Me.WebReport1.Report.SetParameterValue("Spruch", dh.Get_Option(3)) Me.WebReport1.Report.SetParameterValue("URL", dh.Get_Option(27)) ' Me.WebReport1.Report.SetParameterValue("URL", "..\bilder\reportlogo.jpg") End Sub 'Protected Sub RadButton2_Click(sender As Object, e As EventArgs) Handles RadButton2.Click ' Me.WebReport1.Prepare() ' Me.WebReport1.Prepare() ' Dim exp As New FastReport.Export.Pdf.PDFExport ' Dim fn As String = Server.MapPath("~/Reporting/") + System.IO.Path.GetRandomFileName + ".pdf" ' Me.WebReport1.Report.Export(exp, fn) ' Dim downloadfile As New System.IO.FileInfo(fn) ' HttpContext.Current.Response.Clear() ' HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", downloadfile.Name)) ' HttpContext.Current.Response.AddHeader("Content-Length", downloadfile.Length.ToString()) ' HttpContext.Current.Response.ContentType = "application/octet-stream" ' HttpContext.Current.Response.WriteFile(downloadfile.FullName) ' HttpContext.Current.Response.End() 'End Sub Protected Sub RadAjaxManager1_AjaxRequest(sender As Object, e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest End Sub Private Sub RadListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RadListBox1.SelectedIndexChanged Me.RadListBox2.DataBind() End Sub Protected Sub RadListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RadListBox2.SelectedIndexChanged Session("RadList1value") = Me.RadListBox1.SelectedValue Session("RadList2Value") = Me.RadListBox2.SelectedValue Dim dh As New clsDatahandling Dim ds As New DataSet ds = dh.Get_Tabledata("Select * from web_report where id=" + Me.RadListBox2.SelectedValue, False, True) If ds.Tables(0).Rows(0).Item("Folder") = False Then Session("Reportnr") = Me.RadListBox2.SelectedValue Response.Redirect("~/Administration/Webreport.aspx?Reportnr=" + Me.RadListBox2.SelectedValue.ToString) End If End Sub End Class