首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从ASP.net显示来自ReportViewer DrillThrough事件的钻取报告?

如何从ASP.net显示来自ReportViewer DrillThrough事件的钻取报告?
EN

Stack Overflow用户
提问于 2018-10-12 09:15:14
回答 1查看 312关注 0票数 0

我试图让get DrillThrough事件在Final_GenralStatment_Total.rdlc报告中显示链接的报告,但是我得到了以下错误消息:

“数据源‘DataSet1 1’尚未提供数据源实例。”

以下是我的ASP完整代码页:

代码语言:javascript
复制
Imports Microsoft.Reporting.WebForms

公共类FStatement继承System.Web.UI.Page

代码语言:javascript
复制
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

端级

以及完整的html页面:

代码语言:javascript
复制
    <%@ 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>

我很感谢你的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-12 19:21:46

也许你想试试这个:

代码语言:javascript
复制
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

另外,您可能想看看这个教程 (不幸地使用了C#)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52776216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档