Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (IsPostBack) Then
Return
End If
Dim ReportName = "RdlReport1"
''加载报表
LoadPageReport(ReportName)
End Sub
Private Sub LoadPageReport(ByVal reportName As String)
Dim report As GrapeCity.ActiveReports.PageReport = Nothing
report = New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(Server.MapPath("../Reports/" + reportName + ".rdlx")))
'事件的邦定
AddHandler report.Document.LocateDataSource, AddressOf Document_LocateDataSource
'事件的邦定
' AddHandler WebViewer1.LocateDataSource, AddressOf Document_LocateDataSource
WebViewer1.Report = report
WebViewer1.ViewerType = GrapeCity.ActiveReports.Web.ViewerType.FlashViewer
WebViewer1.FlashViewerOptions.TocPanelOptions.ShowThumbnails = False
WebViewer1.FlashViewerOptions.TocPanelOptions.ShowToc = True
WebViewer1.FlashViewerOptions.TocPanelOptions.Visible = True
WebViewer1.FlashViewerOptions.ShowSplitter = False
End Sub
Sub Document_LocateDataSource(ByVal sender As Object, ByVal args As GrapeCity.ActiveReports.LocateDataSourceEventArgs)
If args.DataSourceName = "DataSource1" Then
Dim data As DataTable = New DataTable()
data.Columns.Add("Id")
data.Columns.Add("Name")
data.Columns.Add("Subject")
data.Columns.Add("Score")
data.Rows.Add(1, "张三", "数学", 90)
data.Rows.Add(1, "张三", "语文", 89)
data.Rows.Add(1, "张三", "英语", 90)
data.Rows.Add(2, "李四", "数学", 90)
data.Rows.Add(2, "李四", "语文", 89)
data.Rows.Add(2, "李四", "英语", 90)
''数据绑定
args.Data = data
End If
End Sub |