如何显示来自 ReportViewer DrillThrough 事件的 ASP.net 的钻取报告?
How can I display the drillthough report from ASP.net from the ReportViewer DrillThrough event?
我正在尝试获取 DrillThrough 事件以在 Final_GenralStatment_Total.rdlc 报告中显示链接的报告,但我收到以下错误消息:
"A data source instance has not been supplied for the data source 'DataSet1'."
这是我的 ASP 完整代码页:
Imports Microsoft.Reporting.WebForms
Public Class F语句
继承 System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub ReportViewer1_Drillthrough(sender As Object, e As DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
Try
Dim report As LocalReport = CType(e.Report, LocalReport)
'Dim ds As DataSet = New DataSet()
Dim dt As DataTable = New DataTable()
Dim adp As New INV_INDDataSetTableAdapters.Final_GSInterestTotalsTableAdapter
Dim rds As ReportDataSource = New ReportDataSource("DataSet1", dt)
ReportViewer1.LocalReport.DataSources.Add(rds)
Catch ex As Exception
Throw
End Try
End Sub
结束Class
完整的 html 页面:
<%@ Page Title="Final Statement" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="FStatement.aspx.vb" Inherits="Pension.FStatement" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
Final Statement
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table align="center">
<tr>
<td>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
ZoomMode="PageWidth" AsyncRendering="False" Height="100%"
ShowPromptAreaButton="False" ShowZoomControl="False" SizeToReportContent="True"
Width="100%" PageCountMode="Actual" BackColor="" ClientIDMode="AutoID" HighlightBackgroundColor="" InternalBorderColor="204, 204, 204" InternalBorderStyle="Solid" InternalBorderWidth="1px" LinkActiveColor="" LinkActiveHoverColor="" LinkDisabledColor="" PrimaryButtonBackgroundColor="" PrimaryButtonForegroundColor="" PrimaryButtonHoverBackgroundColor="" PrimaryButtonHoverForegroundColor="" SecondaryButtonBackgroundColor="" SecondaryButtonForegroundColor="" SecondaryButtonHoverBackgroundColor="" SecondaryButtonHoverForegroundColor="" SplitterBackColor="" ToolbarDividerColor="" ToolbarForegroundColor="" ToolbarForegroundDisabledColor="" ToolbarHoverBackgroundColor="" ToolbarHoverForegroundColor="" ToolBarItemBorderColor="" ToolBarItemBorderStyle="Solid" ToolBarItemBorderWidth="1px" ToolBarItemHoverBackColor="" ToolBarItemPressedBorderColor="51, 102, 153" ToolBarItemPressedBorderStyle="Solid" ToolBarItemPressedBorderWidth="1px" ToolBarItemPressedHoverBackColor="153, 187, 226" ShowBackButton="False" ShowRefreshButton="False">
<LocalReport ReportPath="Reports\Final_GenralStatment_Total.rdlc" EnableHyperlinks="True">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ODSFStatement" Name="DataSet" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ODSFStatement" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="Pension.INV_INDDataSetTableAdapters.Final_GenralStatment_TotalTableAdapter"></asp:ObjectDataSource>
</td>
</tr>
</table>
</asp:Content>
感谢您的帮助。
也许你想试试这个:
Protected Sub ReportViewer1_Drillthrough(sender As Object, e As Microsoft.Reporting.WebForms.DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
Dim lclRep As LocalReport = CType(e.Report, LocalReport)
Dim adp As New Pension.INV_INDDataSetTableAdapters.Final_GSInterestTotalsTableAdapter
Dim rds As New ReportDataSource("DataSet1", CType(adp.GetData(), DataTable))
lclRep.DataSources.Add(rds)
End Sub
此外,您可能想看看这个 tutorial(不幸的是使用 C#)。
我正在尝试获取 DrillThrough 事件以在 Final_GenralStatment_Total.rdlc 报告中显示链接的报告,但我收到以下错误消息:
"A data source instance has not been supplied for the data source 'DataSet1'."
这是我的 ASP 完整代码页:
Imports Microsoft.Reporting.WebForms
Public Class F语句 继承 System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub ReportViewer1_Drillthrough(sender As Object, e As DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
Try
Dim report As LocalReport = CType(e.Report, LocalReport)
'Dim ds As DataSet = New DataSet()
Dim dt As DataTable = New DataTable()
Dim adp As New INV_INDDataSetTableAdapters.Final_GSInterestTotalsTableAdapter
Dim rds As ReportDataSource = New ReportDataSource("DataSet1", dt)
ReportViewer1.LocalReport.DataSources.Add(rds)
Catch ex As Exception
Throw
End Try
End Sub
结束Class
完整的 html 页面:
<%@ Page Title="Final Statement" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="FStatement.aspx.vb" Inherits="Pension.FStatement" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
Final Statement
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table align="center">
<tr>
<td>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
ZoomMode="PageWidth" AsyncRendering="False" Height="100%"
ShowPromptAreaButton="False" ShowZoomControl="False" SizeToReportContent="True"
Width="100%" PageCountMode="Actual" BackColor="" ClientIDMode="AutoID" HighlightBackgroundColor="" InternalBorderColor="204, 204, 204" InternalBorderStyle="Solid" InternalBorderWidth="1px" LinkActiveColor="" LinkActiveHoverColor="" LinkDisabledColor="" PrimaryButtonBackgroundColor="" PrimaryButtonForegroundColor="" PrimaryButtonHoverBackgroundColor="" PrimaryButtonHoverForegroundColor="" SecondaryButtonBackgroundColor="" SecondaryButtonForegroundColor="" SecondaryButtonHoverBackgroundColor="" SecondaryButtonHoverForegroundColor="" SplitterBackColor="" ToolbarDividerColor="" ToolbarForegroundColor="" ToolbarForegroundDisabledColor="" ToolbarHoverBackgroundColor="" ToolbarHoverForegroundColor="" ToolBarItemBorderColor="" ToolBarItemBorderStyle="Solid" ToolBarItemBorderWidth="1px" ToolBarItemHoverBackColor="" ToolBarItemPressedBorderColor="51, 102, 153" ToolBarItemPressedBorderStyle="Solid" ToolBarItemPressedBorderWidth="1px" ToolBarItemPressedHoverBackColor="153, 187, 226" ShowBackButton="False" ShowRefreshButton="False">
<LocalReport ReportPath="Reports\Final_GenralStatment_Total.rdlc" EnableHyperlinks="True">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ODSFStatement" Name="DataSet" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ODSFStatement" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="Pension.INV_INDDataSetTableAdapters.Final_GenralStatment_TotalTableAdapter"></asp:ObjectDataSource>
</td>
</tr>
</table>
</asp:Content>
感谢您的帮助。
也许你想试试这个:
Protected Sub ReportViewer1_Drillthrough(sender As Object, e As Microsoft.Reporting.WebForms.DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
Dim lclRep As LocalReport = CType(e.Report, LocalReport)
Dim adp As New Pension.INV_INDDataSetTableAdapters.Final_GSInterestTotalsTableAdapter
Dim rds As New ReportDataSource("DataSet1", CType(adp.GetData(), DataTable))
lclRep.DataSources.Add(rds)
End Sub
此外,您可能想看看这个 tutorial(不幸的是使用 C#)。