我有一个常规的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>
非常感谢任何帮助!
答案 0 :(得分:0)
您收到的错误表明加载了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"/>
要解决特定错误,应删除Infragistics4.Web.v13.1引用。
请注意,web.config中也存在重复引用,以便其他Infragistics程序集也应该被删除。如果不删除这些,您可能会看到其他类的类似错误。
如果删除4或45版本的程序集并且我建议删除4版本也没关系,因为页面(或用户控件)中的Register标记引用了45版本。