我在学习自定义控件,我写了一个mycontrol.cls文件用来输出hello world字样,文件如下:
Imports System
Imports System.Web
Imports System.Web.UI
Namespace mycontrols
public Class mycontrol:Inherits Control
protected overrides Sub Render(output as HtmlTextWriter)
output.Write("hello worldW! davie")
End Sub
End Class
End Namespace然后我用VBC.EXE编译成一个control.dll文件,再写了一个hello.aspx文件调用,文件如下:
<%@ Register Tagprefix="davide" Namespace="mycontrols" assembly="mycontrol" %>
<html>
<body>
<davide:mycontrol runat="server"/>
</body>
</html>可是当我预览是报错,如下:
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: BC30560: “mycontrol”在命名空间“mycontrols”中不明确。源错误: 行 2: <html>
行 3: <body>
行 4: <davide:mycontrol runat="server"/>
行 5: </body>
行 6: </html>
源文件: C:\Inetpub\ASP_NET\TMP7iy7hn2hbu.aspx 行: 4 请问这是错在那里呢?我是菜鸟来的,请各位多多指交!
Imports System
Imports System.Web
Imports System.Web.UI
Namespace mycontrols
public Class mycontrol:Inherits Control
protected overrides Sub Render(output as HtmlTextWriter)
output.Write("hello worldW! davie")
End Sub
End Class
End Namespace然后我用VBC.EXE编译成一个control.dll文件,再写了一个hello.aspx文件调用,文件如下:
<%@ Register Tagprefix="davide" Namespace="mycontrols" assembly="mycontrol" %>
<html>
<body>
<davide:mycontrol runat="server"/>
</body>
</html>可是当我预览是报错,如下:
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: BC30560: “mycontrol”在命名空间“mycontrols”中不明确。源错误: 行 2: <html>
行 3: <body>
行 4: <davide:mycontrol runat="server"/>
行 5: </body>
行 6: </html>
源文件: C:\Inetpub\ASP_NET\TMP7iy7hn2hbu.aspx 行: 4 请问这是错在那里呢?我是菜鸟来的,请各位多多指交!
解决方案 »
- 邮件发送失败,System.IO.IOException: 由于远程方已关闭传输流,身份验证失败。
- 请分别比较JDBC ADO ADO.NET并说明三者之间的异同点及优势
- 字符串带@后如何使用变量
- 请问谁见过这个错误?
- datareader 求助
- asp.net 2.0 常量有换行符的问题
- 如何点击calendar可以从数据库中读出相应某天的工作安排
- 关于asp.net后台调用前台js问题急~~~!!
- 请教:C#中是否有类似VB中Collection的类?
- ASP.NET中如何用程序将excel中的数据导入到数据库中(C#)
- C#如何给客户端注册教本
- 学习ASP.NET之前是否要对C#有很深的了解
do not use the same name both for your class and your filemycontrol.clslike this:
Imports System
Imports System.Web
Imports System.Web.UI
Namespace mycontrols
public Class MyHelloWorldControl:Inherits Control
protected overrides Sub Render(output as HtmlTextWriter)
output.Write("hello worldW! davie")
End Sub
End Class
End Namespaceyour .aspx file like this:
<%@ Register Tagprefix="davide" Namespace="mycontrols" assembly="mycontrol" %>
<html>
<body>
<davide:MyHelloWorldControlrunat="server"/>
</body>
</html>
r you chinese???
i want to make friends with you.
do you have QQ or OICQ???