错误 2 "WebDataGrid"在命名空间'Infragistics.Web.UI.GridControls'中不明确



我有一个普通的aspx网页,有一次我试图调试它,它随机给了我这个问题:

错误2"WebDataGrid"在命名空间"Infrastatics.Web.UI.GridControls"中不明确。

这是我的代码的一部分

<%@ Register Assembly="Infragistics45.Web.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table>
    <tr>
        <td>
            <ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px">
            </ig:WebDataGrid>
        </td>
</tr>
</table>

这是我的web.config文件

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="infragistics.web" type="System.Configuration.SingleTagSectionHandler,System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <sectionGroup name="businessObjects">
      <sectionGroup name="crystalReports">
        <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name="masterConnectionString" connectionString="Data Source=dmandelbaum_pcSQLExpress;Initial Catalog=master;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <infragistics.web styleSetName="Default" styleSetPath="~/ig_res"/>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Infragistics4.Web.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="Infragistics4.WebUI.Documents.Reports.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Infragistics4.WebUI.Documents.Excel.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="Infragistics4.WebUI.Documents.Word.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="Infragistics4.WebUI.Documents.IO.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="Infragistics45.Web.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="Infragistics45.WebUI.Documents.Reports.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="Infragistics45.WebUI.Documents.Excel.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="Infragistics45.WebUI.Documents.Word.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
        <add assembly="Infragistics45.WebUI.Documents.IO.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
      </assemblies>
      <buildProviders>
        <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      </buildProviders>
    </compilation>
  </system.web>
  <businessObjects>
    <crystalReports>
      <rptBuildProvider>
        <add embedRptInResource="true"/>
      </rptBuildProvider>
    </crystalReports>
  </businessObjects>
</configuration>

如有任何帮助,我们将不胜感激!

您得到的错误表明加载了两个版本的Infrastics.Web程序集,由于这两个版本中都存在该类型,编译器不知道该使用哪一个。

如果你仔细查看web.config,你会看到两个引用:

<add assembly="Infragistics4.Web.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
<add assembly="Infragistics45.Web.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>

要解决特定错误,应删除Infrasgistics4.Web.v13.1引用。

请注意,web.config中还存在对其他Infrastics程序集的重复引用,这些程序集也应删除。如果不删除这些,您可能会在其他类中看到类似的错误。

此外,如果删除程序集的4或45版本也没关系,我建议删除4版本,因为页面(或用户控件)中的Register标记引用了45版本。

相关内容

  • 没有找到相关文章

最新更新