基类包括字段'report',但其类型(Microsoft.Reporting.WebForms.ReportViewer)是

时间:2015-05-11 11:12:50

标签: c# asp.net report

我很绝望。我有一个报告查看器的页面,直到几天前工作。我没有更改我的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。

1 个答案:

答案 0 :(得分:5)

我找到了一个似乎有意义的答案:

尝试添加引用:Microsoft.Reporting.WebForms 然后,如果你得到另一个错误,请尝试比较&lt;%@ Register Assembly =“Microsoft.ReportViewer.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

相关问题