Asp.net的ObjectDataSource TypeName属性错误 [英] Asp.net objectdatasource TypeName property error

查看:249
本文介绍了Asp.net的ObjectDataSource TypeName属性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 ASP:ObjectDataSource控件网​​格数据绑定

我的问题是,当我运行这个code,我得到错误。

My problem is when I run this code I get error.

<asp:ObjectDataSource ID="odsListing" 
runat = "server"  
SelectMethod = "MethodNameOfCodeBehindClass"
TypeName = "FolderName_CodeBehindClassName" ></asp:ObjectDataSource>

错误消息

The type specified in the TypeName property of 
ObjectDataSource 'odsListing' could not be found.

所以,我把我的code至codebehind网站。

So I move my code to codebehind site.

    #region ObjectDataSource for Grid Binding
    Type type = typeof(FolderName_CodeBehindClassName);
    string assemblyQualifiedName = type.AssemblyQualifiedName;

    odsListing.TypeName = assemblyQualifiedName;
    odsListing.SelectMethod = "ListingDatabind";
    #endregion

现在万物是确定的。这就是工作。
不过,我想知道我的问题实际的解决方案。
为什么养的错误?

Now Everythings is ok. It is work. But I would like to know actual solution for my problem. Why it raise error?

其实,我并不想动我的code至codebehind层,如果它可以在设计层写字。

Actually, I don't want to move my code to codebehind layer if it can write at design layer.

每一个建议将是AP preciated。

Every suggestion will be appreciated.

推荐答案

的问题是,你正在使用的不是全类型名称short类型名称。

The problem is that you are using short type name instead of full type name.

替换 FolderName_ codeBehindClassName The.NameSpace.YouHaveYourTypeIn.FolderName_ codeBehindClassName,Name.Of.Your.Assembly

这篇关于Asp.net的ObjectDataSource TypeName属性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆