【问题标题】:The base class includes the field 'report', but its type (Microsoft.Reporting.WebForms.ReportViewer) is基类包括字段“报告”,但其类型 (Microsoft.Reporting.WebForms.ReportViewer) 是
【发布时间】:2015-05-11 11:12:49
【问题描述】:

我很绝望。我的这个页面有一个报告查看器,直到几天前才有效。我没有更改我的 webconfig 或其他任何内容,但我现在收到此错误。这是我的 ASP.NET 代码:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RisultatoStampaPdf.aspx.cs" Inherits="Fatture.Pagine.StampaDocumenti.RisultatoStampaPdf" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
---code---

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="BodyContent" runat="server">
    <div align="center">
        <h4>Premere il pulsante "Salva" e scegliere il formato desiderato</h4>
        <asp:Label ID="lblErrore" runat="server" Text=""></asp:Label>
        <rsweb:ReportViewer runat="server" ID="report" Font-Names="Calibri" Font-Size="12pt" WaitMessageFont-Names="Calibri" WaitMessageFont-Size="14pt" Width="740px" Height="500px">
            <LocalReport ReportPath="ReportFatture.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet2" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="Fatture.DataSet2TableAdapters.DataTable1TableAdapter">
            <SelectParameters>
                <asp:Parameter Name="id_documento" Type="Int64" />
                <asp:Parameter Name="id_cliente" Type="Int64" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <br />
        <asp:Button ID="btnReindirizza" class="btn btn-info" runat="server" Text="Torna indietro" OnClick="btnReindirizza_Click" />
        <hr />
    </div>
</asp:Content>

我正在使用 .NET Framework 4.51。

【问题讨论】:

  • 错误信息是什么?
  • 运行时错误并显示以下消息:基类包含字段“报告”,但其类型 (Microsoft.Reporting.WebForms.ReportViewer) 与控件类型 (Microsoft.Reporting. WebForms.ReportViewer)
  • dll 有变化吗? Visual Studio 的版本?这是我找到的类似答案:stackoverflow.com/questions/820396/… 请告诉我是否有帮助。

标签: c# asp.net report


【解决方案1】:

我找到了一个似乎有道理的答案:

尝试添加引用:Microsoft.Reporting.WebForms 然后,如果您遇到另一个错误,请尝试比较 Version=11.0.0.0 和您添加的参考中写入的版本,如果将版本更改为 Microsoft.ReportViewer.WebForms 的版本存在差异。

希望它会有所帮助。 这是一个链接:https://mohamedelkassas.wordpress.com/2014/04/21/the-base-class-includes-the-field-xxx-but-its-type-microsoft-reporting-webforms-reportviewer-is-not-compatible-with-the-type-of-control-microsoft-reporting-webforms-reportviewer/

另一个解决方案:http://snahta.blogspot.co.il/2012/01/microsoftreportingwebformsreportviewer.html

【讨论】:

    猜你喜欢
    • 2013-09-17
    • 1970-01-01
    • 2011-04-14
    • 1970-01-01
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2012-01-04
    相关资源
    最近更新 更多