CS0246:找不到类型或命名空间名称'tdetails'(您是否缺少using指令或程序集引用?) [英] CS0246: the type or namespace name 'tdetails' could not be found (are you missing a using directive or an assembly reference? )

查看:144
本文介绍了CS0246:找不到类型或命名空间名称'tdetails'(您是否缺少using指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi,

I am working on asp.net web application and I have created a class named 'tdetails'
but neither it showing on intellisense of another .aspx.cs nor it working where I have to use properties and functions of this class for data insert update and delete.when I run the application.
It is showing a message-The type or namespace name 'TDetails' could not be found(are you missing a using directive or an assembly reference  )



















我的尝试:





What I have tried:

I have chandged build action property of the class to compile but still it is giving error. I have created it outside app_code.

推荐答案

您需要添加对要使用它的类的引用。如果类是静态的,你可以直接访问成员,如果没有,你需要创建类的对象并使用该对象来访问成员。



有关如何添加参考的更多信息,请访问此处
You need to add a reference to the class where you want to use it. If the class is static you can access the members directly, if not, you'll need to create an object of the class and use the object to access the members.

For more information on how to add a reference visit here.

最后我把它放在App_Code中然后我得到了新的错误
At last I put it in App_Code then I got new error
Exception Details: System.Web.HttpException: Content controls have to be top-level controls in a content page or a nested master page that references a master page.

这是由于< asp:content runat = server我错过了把runat = server属性放到它上面所以我得到了那个错误。现在它已经解决了。



谢谢......

It was due to <asp:content runat=server I missed to put runat= server attribute to it so I was getting that error. Now it is resolved.

thanks...


这篇关于CS0246:找不到类型或命名空间名称'tdetails'(您是否缺少using指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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