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

Asp.net 错误 ;2 ';WebDataGrid';在命名空间中不明确';Infragistics.Web.UI.GridControls';,asp.net,infragistics,Asp.net,Infragistics,我有一个常规的aspx网页,有一次我试着调试它,它随机地给了我这个问题: 错误2“WebDataGrid”在命名空间“Infragistics.Web.UI.GridControls”中不明确 这是我代码的一部分 <%@ Register Assembly="Infragistics45.Web.v13.1, Version=13.1.20131.2331, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="I

我有一个常规的aspx网页,有一次我试着调试它,它随机地给了我这个问题:

错误2“WebDataGrid”在命名空间“Infragistics.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_pc\SQLExpress;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>


任何帮助都将不胜感激

您收到的错误表明有两个版本的Infragistics.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"/>

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

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


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

尝试重新启动VS project。能否在此处提供web.config文件?请尝试在服务器端代码中显式引用(Infragistics45.web.v13.1)dll。