一个有关自定义控件的简单问题,初学者
项目名称:denghan
test1.aspx
-------------------------------------------------------
<%@ Register TagPrefix="SimpleControlSamples" Namespace="SimpleControlSamples" Assembly="SimpleControlSamplesVB" %>
<html>
<body>
<form method="POST" action="Simple.aspx" runat=server>
<SimpleControlSamples:SimpleVB id="MyControl" runat=server/>
</form>
</body>
</html>
test1.aspx.vb
------------------------------------------------
Imports System
Imports System.Web
Imports System.Web.UI
Namespace SimpleControlSamples
Public Class SimpleVB : Inherits Control
Protected Overrides Sub Render(Output As HtmlTextWriter)
Output.Write("<H2>欢迎使用控件开发!</H2>")
End Sub
End Class
End Namespace
之后按“生成”->"生成 denghan"后,在项目目录的bin子目录里看到denghan.dll文件。
“文件”-》"在浏览器中查看"出错:
分析器错误信息: 找不到文件或程序集名称“SimpleControlSamplesVB”,或找不到它的一个依赖项。
源错误:
行 1: <%@ Register TagPrefix="SimpleControlSamples" Namespace="SimpleControlSamples" Assembly="SimpleControlSamplesVB" %>
行 2:
行 3: <html>
我是初学者,弄了一个下午都没搞定,请高手们指教,百分感谢!