简体   繁体   English

ObjectDataSourceControl无法在导入的命名空间中找到类型

[英]ObjectDataSourceControl unable to find Type in imported namespace

I have an aspx page in a ASP.NET 2.0 application using several ObjectDataSources. 我在使用多个ObjectDataSources的ASP.NET 2.0应用程序中有一个aspx页面。 They are all bound to the same class like so: 它们都绑定到同一类,如下所示:


<asp:ObjectDataSource ID="TitleDataSource" runat="server" OnSelecting="TitleDataSource_Selecting" SelectMethod="GetTitle" TypeName="DropDownDataSource"></asp:ObjectDataSource>

This was working fine. 一切正常。 Then I made two changes 然后我做了两个改变

  1. Moved the DropDownDataSource from the app_code directory to a separate assembly DropDownDataSourceapp_code目录移动到单独的程序集
  2. changed the namespace of the class was com.companyname.ie , now com.companyname.ie.appname 将该类的命名空间更改为com.companyname.ie ,现在更改为com.companyname.ie.appname

Now I get a "Type Specified in TypeName of 'TitleDataSource' could not be found" error message when I hit the page. 现在,当我点击页面时,收到“找不到在'TitleDataSource'的TypeName中指定的类型”错误消息。

I can fix this by specifying the fully qualified name of the class in TypeName . 我可以通过在TypeName指定类的完全限定名称来解决此问题。 But adding an <% @import directive with the same namespace does not resolve the error. 但是,添加具有相同名称空间的<% @import指令不能解决该错误。

I've also tried moving my code back into app_code to no avail. 我也尝试将我的代码移回app_code ,但无济于事。

Intellisense picks up the Type without me specifying the namespace. Intellisense在不指定名称空间的情况下选择Type。

Its not a massive problem, but its very annoying. 这不是一个大问题,但非常烦人。 Any suggestions? 有什么建议么?

Specifying the fully qualified name is correct. 指定标准名称是正确的。 Otherwise the runtime will only look in the current assembly. 否则,运行时将仅在当前程序集中查找。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM